Same as how they gained the market share in the first place - deals with sellers, businesses, governments. In some places, it was more expensive to not bundle Windows with a new laptop than to bundle it. Governments were given deals, support and bribes to build their infra on Microsoft products, including teaching Windows, Office in schools. And in the meantime, competition was stifled by any means necessary.