But, the modern worldwide digital economy is possible exactly because programmers exchange results of their work for free
That's not actually how open source works.
As a developer, I use the open source product and build upon it. I submit my changes back to the source because I want other updates to be made with my changes in mind.
If I tried to do it the other way, I would have to rewrite my personal changes with every update of the source that touched the same files or interfaces. It is less work for me to submit back to source than it is to do those constant updates.
The whole thing works because I can sell my skills as one who configures open source software, modifies it, and in general makes it work. My customers connect with me. They aren't qualified to do the things that I do. They appreciate my contribution monetarily. That is to say, they pay me. And they pay me more for things that help them more.
TL;DR: Open source is science. Each new piece of knowledge builds on the old. The more that the knowledge is shared, the faster that it can grow.
Contrast this with the communist model. There, my customers do not pay me. I am "paid" by the state. I am paid the same whether I have many customers or few. So why would I have many? I can get the same pay with just a few. Why develop that clever thing that makes the software work better? It's no skin off my nose. It can stay small forever. So I never get to the point of considering whether to give back.
Worse, let's say that I did add functionality to the software. Afterwards, I would have even more work that I'd be expected to do. I would be the expert on that modification. Since I have the ability, from each according to ability would lead to me being the one to provide support. And I would be expected to make additional modifications to make that work. People would soon learn that such initiative would be punished rather than rewarded. And they stop doing it.
TL;DR: Communism and open source are fundamentally incompatible.
Of course, a real society may compromise on communist ideals to make the system work. Instead of paying all developers the same, they might give additional perks to better developers. So to each according to ability and from each according to need, a free market system. Also called capitalism.
By contrast, with capitalism, there are strong incentives for companies to share open source software. At any given moment, the open source software is cheaper to use, as the company doesn't have to pay monopoly rents to start using it. They only have to pay for their modification. And once purchased, it is to the company's advantage to return the modification to the source so that people will keep it updated as they add other modifications.
If a company tries to make a proprietary alternative instead, then the company pays the entire cost of development and updates. Further, the company faces the problem of features being available in the open source alternative that are not available in the proprietary software. Occasionally this will work. Oracle, DB2, and Microsoft's SQL Server are all proprietary versions of database software competing with free versions like MariaDB (MySQL) and PostgreSQL.
Other times, the open source software will push out the proprietary software. Solaris is gone. Linux and various BSD variants survive. Only Microsoft's Windows remains among the proprietary alternatives, and it is mainly a desktop kernel that they also use for servers.
TL;DR: Capitalism is compatible with an open source model. Their incentives reinforce each other.