IBM was under considerable antitrust pressure at that time. Retaining all OS rights posed a substantial legal risk to their real business (see the Feds vs the Unix OS, forcing AT&T not to greedily enforce their rights to that OS) so IBM decided not to try to corner a second market, and really get Federal heat. Bill Gates wasn't smarter than IBM, he was smarter than his competitors, and undercut their price: he knew that Basic, etc would pay the bills for some time, so he could settle for a smaller price than others would have charged, while he waited for a bigger future payoff. His mom was also very well connected with IBM.