Yes, they write free software, and to it - a manual for ten thousand pages. And control is from the command line with crazy syntax. And if you don't want to comprehend all the secrets of their software, where and when it bugs and how to configure it so that it doesn't crash, then there are always courses (paid), seminars (sponsored), technical support contracts (paid) or software for normal management and monitoring of free software.
Giants like IBM and Google generously sponsor various OpenSource projects.
And then the contributors (programmers) consider it an honor to indicate in their resume that their commits (contribution to the development) useful to someone.
In fact, it looks like this: we write something for free, we don't know what. And for it to work - if you please pay, and no matter who: you can buy books like "Linux for Dummies", send your employees to seminars or buy technical support - you still understand that for large companies like banks, pharmacists or insurers, nothing is free, and OpenSource software is as expensive as electricity bills.
There is a company called RedHat, which develops free and open source software, whose annual turnover reaches a billion dollars. Anyone can download the software they develop, including the source code, from their website.
The secret is that this business model does not involve trading in air. In this case, services are provided to support and refine software for some highly specialized needs for money.
Usually open source free software is released by enthusiasts who saw applications for the sake of an idea. Some software becomes popular and corporations can cut it, in particular, the same linux is developed with the help of the linux foundation, which includes many corporations, and some software is sponsored by foundations - for example