I believe Microsoft licensed MSDOS to IBM and eventually to other pc manufacturers, rather than selling it to them. every PC ibm, and others sold, had MSDOS on it, and Microsoft got their license payment. Clever stuff by Bill Gates and his financial advisor, when Windows came along they did much...
Weren't IBM running MSDOS on their computers already? Microsoft wrote Windows to run on MSDOS, thus IBM never stood a chance, it was possibly their own fault for licensing MSDOS rather than buying it from Bill Gates.