The salaries of the people who work on those projects are paid by the revenue streams generated by the companies.
What the FSF calls "free software" and what OSI calls "open source" are essentially mechanisms for implementing such approaches in a capitalist context, in which the abstraction of "intellectual property" is enshrined in law.