That's a myth that people need to stop spreading.
Microsoft is a business. Microsoft is also not stupid. If it cost them more to provide a product than it makes them, they wouldn't provide it. They're is a huge amount of examples of them doing this. They don't provide it because they're nicer guys.
Microsoft uses Windows, and all of it's products, as a vehicle for Azure and advertisers. Everything they do feeds into that one way or another.
Microsoft stopped being a software company some time ago.