I notice someone else mentioned that software is a zero marginal cost product. This is an element that drives the cost down to zero when there is competition. But software is more than just zero marginal cost. An additional passenger on an airplane is zero marginal cost as well, but they can still charge for a ticket because it is trivial to keep someone off of an airplane.
The bigger problem with software is its a public good. I don't mean that as some kind of normative statement saying it should be or deserves to be provided free of cost to all users of a particular state. I'm saying it is non-rivalrous (some sequence of bytes copied onto person A's disk does not prevent person B from copying the same sequence of bytes onto their disk) and non-excludable (due to the nature of disks and bytes, you can't prevent a person from doing it.
Not all goods that are public goods by the economic definition need to be publicly provided. Media has this same characteristic, and they solve it by:
1) Making money off of live performances or theatrical experiences rather than the content
2) Selling ads
There is an analogy to selling live performances in the software world. At the company I work for, every product we make is 100% free-to-use, open source, self-hostable, doesn't require an enterprise edition to unlock features, and doesn't include any kind of user-tracking to sell ads. Instead, we sell support, and also embed developers as consultants into client organizations. This is why I currently work for the Air Force. We're monetizing the developers rather than the software, the same way rock bands monetize live performance.
The only other options are to either figure out some unnatural gating mechanism to prevent people from using your software without going through a payment gate (i.e. don't open-source it and only host it on your own servers, or distribute some of the software in encrypted form only and require a paid key to unlock it, or you sell ads.
In traditional media, ads were fine. They were annoying, manipulative, I don't think anyone really liked them, but some were entertaining (arguably a draw of the Super Bowl), it was always easy to avoid them, and they were entirely targeted based on context.
The problem with ads in the software world isn't the ads themselves. It's that companies relying on ads to monetize are never happy with the returns you can get purely from contextual ads. You can learn so much more about a consumer's purchasing behavior and preferences by installing spyware on every device they own and logging every action they ever take, all the better when most of them don't even know you're doing it.
But this is the classic Jurassic Park dilemma. All of your machine learning researchers were so preoccupied with figuring out what human behaviors they could predict given enough data that they never stopped to consider whether they should collect all that data. Market research used to be conducted on paid volunteer focus groups and paid volunteer Nielsen families. They consented to it. They knew what data you were collecting and how you would use it.
But not happy with the limits of profit margin imposed on what data can be voluntarily collected from consenting research subjects, we have instead built a panopticon to turn every single person in the world into an unknowing research subject.