A little more complex than that.
The best that has been pieced together is that Garry Kildall was in Japan negotiating a contract when IBM came by.
IBM was asked to negotiate with Kildall's wife. She was the correct officer to negotiate with, but IBM didn't negotiate with women back then and it made them uncomfortable.
Mrs. Kildall found the contract IBM offered so totally one-sided she couldn't sign it and turned it over to legal for an opinion. This further infuriated IBM.
There was also a rumored undercurrent behind all this, that Garry Kildall had had an affair with an IBM executive's wife. In the IBM culture of the time this made it nearly impossible to adopt Kildall's operating system.
Meanwhile, IBM was negotiating with Gates for Basic. They asked him if he could also supply an operating system.
With no product whatever and no operating system experience, he said "Yes", and with absolutely nothing to loose he signed whatever contract IBM put forward. He figuring he'd re-negotiate it latter when deadlines were close and he had plenty of leverage.
Microsoft then bought a partially completed 16-bit knock-off of CP/M from Seattle Computers. IBM ended up having to finish DOS themselves because Microsoft simply didn't have the skills needed to complete it in time.
Digital Research sued and won (with a gag order as part of the settlement). This is why they were able to produce DR-DOS, because the settlement included the rights to clone MS/IBM DOS.
IBM eventually offered CP/M as an alternative on the IBM PC, but priced it so high nobody would buy it when DOS was so cheap.
Incidentally, you can still buy CP/M-80 with legal license and full documentation from California Digital -
http://www.cadigital.com/software.htm