Yes they're both companies, but Sun open sourced stuff to get you to buy it on Solaris, their traditional cash cow.
Microsoft promotes stuff like Visual Studio Code and Chakra not to sell Windows - their stand at Node Interactive earlier this month had a 50 inch TV running Ubuntu. Instead, they realise you don't necessarily want Windows, and are happy to sell you Azure (which runs Linux VMs and is a pretty good product).