One of the things I've heard people say about free/open source software like Linux (fortunately, not in person) is that it is communist/socialist. Admittedly, RMS linking to every left-wing cause in the world on his homepage doesn't help. In reality, though, free/open source software is the best way that software can be handled in a market economy.
There are two crucial terms here - excludable and rival in consumption. If a good is excludable, it is possible to stop people who have not paid from the good from using it or enjoying its benefits. For example, computers are excludable - if you sell computers, people can't use your computers for themselves without buying them from you. An example of a non-excludable good is a fireworks show - anyone within a few miles can watch and enjoy the fireworks.
If a good is rival in consumption (an more common version of this term is "rival" or "rivalrous", but "rival in consumption" is the way I learned it), one person using the good impairs or prevents others from using it simultaneously. For example, food is rival in consumption. If I eat a sandwich, you can't eat the sandwich, and if you can, it will be in a form that you will not want to eat it in. FM radio is not rival in consumption. Everyone in an eight-mile radius could be listening to the same station, and they would all listen to it the exact same as if they were the only one.
These categories can and do overlap - most goods that are one fall into the other. Fireworks shows and FM radio, two of my examples, are both non-excludable and non-rival - known as public goods - whereas my other two examples, computers and sandwiches, are both excludable and rival in consumption - private goods. It is possible for there to be excludable but non-rival goods (club goods - i.e. cable TV), and non-exclusive goods that are rival in consumption (common goods - i.e. fish in a lake).
Now that I've given everyone a lesson straight out of Economics 101, you may be wondering what the point is. The point is that software is merely computer data. Computer data is neither excludable - I can put a file on the Internet, and everyone in the world could download a copy while I still had mine - nor rival in consumption - two copies of the same data can be used at the same time. This means that computer data like software cannot be effectively sold for a profit.
This results in a situation known as a market failure. This is a situation where the free market, even in idealized conditions, cannot effectively determine a good result. There are two ways you can go with this situation.
The first way is to try and make software excludable and rival in consumption. This is done by taking software out of the sphere of goods and making it a service - i.e. we rent the license key to you, and you can use the software. The problem is, this doesn't always work. Computer data, despite being a public good, is still a good, so it is not very hard to pirate software. Repackaging goods as services is an example of exploiting the free market, and results in high prices, antitrust behavior, and an undesirable market outcome. It doesn't stop the market failure - just gives the people who created the software a bit more money for a while.
The other way is to not try and sell software itself for a profit. This is what free/open source software does. There's no monetary incentive to produce public goods, so we instead make it a community incentive and a volunteer effort. Because of this, we don't have to waste energy fighting an uphill battle against the market forces that make it hard or impossible to profit from software, and can instead focus on making our software the best it can be.
In addition, it's still possible to make money off it: as the Wikipedia article on public goods states, "since most of the benefit of a lighthouse accrues to ships using particular ports, lighthouse maintenance fees can often profitably be bundled with port fees." In other words, we can make money off incidental goods, like computers, or after real services like support, instead of the fake services of license keys.
In conclusion, the way the free market works makes it impractical to sell software itself. By taking software out of the market and into the hands of open source developers, we can let the market work the way it's supposed to.