TL;DR: It was IBM's idea.
IBM never intended to buy any of the software they acquired for the PC - and MS never intended to supply any OS beside Xenix.
But MS (Paul Allen) soon recognized the potential business and acted accordingly.
The Long Read
IBM had no interest whatsoever in setting up a basic software development for the PC. The strategy was to licence as many off-the-shelf products as possible, to level the playing field with existing competition - mostly seen as the Apple II and CP/M world - and give the PC a comparable start. Keep in mind, that, at the time, the PC group wasn't any big scale operation, but rather a small project trying the market against much internal resistance.
The main marketing idea was to premiere the PC as an all around supported middle of the road product, fully developed, covering everything others had, including support by major brand name products. The PC should be recognised as an established force instead of a newcomer.
It was all about speed, cost and a complete offering.
They neither had the manpower nor the money to make everything on their own, so they went full licensing. When licensing, there are basically three strategies:
- Buying the product at whole
- Buying an unlimited, one time license
- Licensing it on a royalty scheme
The first would have meant that IBM would need to set up the capacity to maintain and further develop the product. Not exactly what the rather small team with an unclear future could do. Also it's the most costly solution.
The third would have kept them reliant on continuous support by the manufacturer and complicate calculations, while at the same time keep investment small.
Their choice for the second was to keep risk small and investment definable.
This strategy created also the only caveat they placed on the whole process: Whoever wanted to license his product for the PC at startup had to sign an NDA to abstain from any, even the slightest comment about the project and his or IBM's involvement. It's often said that this was what killed CP/M as OS choice, as they didn't want to sign up the NDA at first. The real factor was that Kildall insisted on royalty based licensing.
In fact, IBM was almost ready to bite and go that way, as CP/M was de facto the OS for next to every software package they intended to use, with no viable alternative in sight. And that's where Microsoft joined the picture.
Microsoft had no intention to go into the OS market (*1). Their business was languages. They were selling for years successfully CP/M with their SoftCards and happy about the deal. Continuing their language business with the PC - even better, without the investment to do SoftCards and reselling CP/M, was all they wanted.
Before the first machines where handed out, IBM did only share some specs, including CPU Type, RAM configurations, and some BIOS information. Next to all developers did start working on 8086/88 S100 bus systems and working on BIOS level, or using some in-house done CP/M alike - or CP/M-86 as well, as it was available already about 8 months before the PC. Microsoft did use S100 bus systems from Seattle Computer Products - as well as their CP/M ripoff called QDOS - a combination many others used as well. SCP was one of the early suppliers of x86 S100 systems.
So when Bill Gates had a meeting with some IBM representatives, and heard about their problems with Kildall's idea of a royalty based system, he jumped in (somewhat pushed by Paul Allen), and offered to supply a CP/M-like system, since they figured licencing it from SCP should go without much trouble. This would not only make sure that the languages deal went through, but also reduce development effort, as it was already the environment they developed for. For Gates it was only meant to be a pass-through job with the chance to make a few more bucks atop of what SCP would ask.
He bought a single non-exclusive one-time payment license from SCP, turned around, and sold it to IBM. That way IBM got a mostly CP/M compatible operating system they could even brand as their own (PC-DOS) to allow software companies to port their existing CP/M software. Perfect solution for MS as well as IBM.
Most important, MS could sell their languages to IBM as well as in addition direct to customers. MS-DOS as a business was only picking up after the PC and slow. It wasn't until about a year later, that MS did actively market MS-DOS (*2) This MS-DOS 1.25 deal also included GW-BASIC for the first time as complete replacement for the IBM BASICA.
It's important to note, that it wasn't until 1985 (!) That MS-DOS 3.2 was available as first stand alone boxed product by Microsoft for (compatible) generic PCs (via manufacturers). Until then, each PC manufacturer had to license their DOS especially for their machine. No matter how compatible or not (*4). And it wasn't until DOS 5, before it became an end-customer product.
Well, it was all against their policies and sheer luck... and the rest is history.
*1 - Well, not entirely true, they just had no intention of making something as primitive as their existing MS-DOS again. MS was, at that time, heavy focused on Xenix. Gates believed that Unix was the future and Xenix was his bet. It was published in summer of 1980 for 8086, 68k, and PDP-11 machines (I think Z8000 as well later on). That's even before IBM contacted MS, and MS licensed QDOS.
All the work put into DOS 2.0 making it more Unix-like was meant to position it as a gateway product toward Xenix. DOS 2.0 should make users comfortable with Unix and software portable toward Xenix. They didn't foresee that implementing the most user notable parts of Unix (directories and redirection) to DOS would make it less likely for them to move anyway.
*2 - Well, there were two contracts with Lifeboat (*3) for Generic x86 machines and Sirius for the Victor 9000. And it wasn't until again much later when Columbia Data Products bought MS-DOS for their MPC, the eventually first (mostly) PC-compatible system.
*3 - it might have been the Lifeboat deal that made Gates realize the potential, as they originally tried to by the whole QDOS rights form SCP at ~200k, which did not work out, so they just licensed MS-DOS on a per-copy basis.
*4 - I still remember making good money translating DOS 3.0 manuals for some Taiwanese company into German. Of course I did never peek into the existing German copies of other manufacturers... that would have made the job way too easy:) Yes, back then each, and every had their own manuals and their own translations:)