Follow the money
Some people sell a read only disk of pre-compiled software. This is how most games are funded. Microsoft is a small part of the gaming market.
Some people get government grants to write software. They often distribute under the BSD license, which permits modification and distribution for free. The BSD license (as used by OpenSSH) ensures that the team responsible for the software get mentioned in any derived product. Teams use this to demonstrate that the tax payer's money they receive is being turned into software that benefits tax payers. There aren't that many people using this model, but the few that are turn out an impressive amount of software with excellent quality.
There are contract programming shops. The bigger ones have great fun making sure that the software agreed to be delivered does not meet the customer's needs. That way they can collect their fees for doing what was asked for, and collect another fee to extend the software to match some of the real requirements.
The vast majority of programmers work for companies that are not in the business of selling software. Outsourcing to India has cost some jobs in this area, but companies have discovered that is much easier to turn requirements into software with an in house programmer than to explain what they think they want to an Indian bean counter who passes on what he understood to a programmer. The way to make inhouse programmers cost effective is to use free/open source software to avoid re-inventing the wheel.
Mr Stallman has spoken up about this expensive form of technological lock-in, but appears to be wasting his time. Half the commentards on this technophile inhabited site are too dim to spot conveyer belts being built ready to ship cash from their bank accounts to Google.