Microsoft has a long and continuing history of taking/stealing other companies work, and incorporating it into Microsoft products. Typically they approach companies with interesting code, and ask for copies of the source to review saying that they were interested in licensing the code. Then take the source that they gain access to, incorporate it into their own product, then go back the the Owner of the code, and break off talks, saying that they changed their minds.
Microsoft did not write MBasic or MSDOS. MSDOS came from a company in Colorado (or was that Washington?) that ported CPM-80 to 16-bits in order to have a 16-bit operating system to sell with an early S-100 8086 (might have been an 8088) processor board that they developed, and were getting ready to market. In this case Microsoft did not steal MSDOS directly, they licensed it for use on the IBM PC from the company who ported it from DRI (stole the code) without permission. I don't remember the name of the company who developed the S-100 board, as that was long ago, but it would be easy enough to look it up. Years later I bought and traded (wholesale) S-100 products with this company. Ultimately the company had a disasterous fire that put them out of business, although the lawsuit lasted for years afterward before it's conclusion.
Early versions of the illegally ported 16-bit operating system, and MSDOS actually contain the DRI copyright text from the original CPM-80 code.
That company that licensed Microsoft to use the code as MSDOS on the 8088 processor later sucessfully sued Microsoft for selling MSDOS for use on processors other than the 8088, claiming that Microsoft's limited license to use the code as MSDOS on 8088 processor based computers did not allow Microsoft to market MSDOS for use on 8086, 80286, 80386, etc... based computers.