That's one way, but not typical.
Here's a fact: Most companies that write software never sell it. The number is huge, something like 90%.
Most software is written in-house for in-house use. It never gets sold.
Since most businesses have the same basic needs, the process of writing software to run internal systems is extremely wasteful. Every company out there that writes a bit of software writes basically the same thing with a few things different for their particular business practices.
Off-the-shelf commercial software doesn't help. It's a one size fits none thing that generally you can't modify to meet your needs.
Enter Open Source software. One company writes it. They give away the source. Hundreds of other companies take it, improve it, and give away the source.
The original company (who was never going to make any money off of the software anyway) gets back a better and more useful product. So do all of the other companies that make changes and release their source.
Everyone ends up with a better, more useful product. No one is out any money. Everyone SAVES money because they don't all have to keep reinventing the wheel.
And that's how you make money off of Open Source. By saving money.
However inhouse development for inhouse use probably applies for software that is closer to what people actually use -- applications and such.
Most of my colleagues working on the Linux kernel are paid by computer system vendors, such as those listed earlier in this thread.
I suspect you are correct however that the majority of open source work is for inhouse use, where money is saved and better software obtained, by sharing development with other companies needing the same kind of software.
Several of the other responses to the question of how companies make money with Linux were good. Yours was Great!