IBM and Microsoft signed an contract, that IBM AT clone computers would ship with Microsoft DOS and they would license (and pay for) every-single-copy of it. The openish IBM PC standard allowed for Microsoft to continually expand into their near monopoly on the Business, and Home PC market.
That agreement literally built Microsoft. When they signed that agreement, Microsoft didn't even own the rights to DOS, or had even made an OS. They just licensed a BASIC compiler.