One of the most common misconceptions about free and open-source software, is that it must cost no money.
Yet , FOSS is not always meant to be free of monetary cost. It's meant to respect the users freedoms, yet it doesn't mean that it will be free of cost. As such, you can expect to have to pay for some FOSS software while expecting to be able to exercise the four freedoms on it.
It's sad to see that at the core of the FOSS philosophy is not monetary gain, but the ability to use the software you acquire(especially the software you pay for) as you see fit to use it. That means that you should get full access to every part of it, even the source code, in order to make it work as you want it to work.
As such, it's on our best interest to be able to make public those changes and to be able to share those changes with others. Any restriction to the users freedoms is to be avoided, since those restrictions don't benefit the user, but the only benefit a few people and restrict the advancement of the software in a way that benefits as much people as possible.
FOSS compliant software is doesn't mean that you can make money out of your work making it. You CAN make money while making FOSS compliant software, and being an active member, of any the communities that make FOSS software. At the end of the day, everyone has to make a living out of what they do.
You make money for working on software, not from the software itself. It means that you need to add code that adds value to the software in order to make money out of it. If you just code thing that already are out, there is no reason for people to pay for the software, or code, you do. That means that no matter if you make a brand new piece of software, or add some code to an existing app, you better make it better for the end user.
At the end, profits and FOSS aren't mutually exclusive.