The Mozilla Foundation is a non-profit organization and the programs it releases are
open source, released under the
Mozilla Public License. Money comes from donations, and most programmers do it because they want to, not because they want to earn money. Furthermore, anyone can help out in programming, so if I see something I don't like that needs fixing and know how to fix it, I can just program it myself and send it to them. They will then decide if my fix is good, or maybe modify it to make it better before implementing it into the program. Or perhaps they'll decide that they don't like my fix. But anyway, you get the point.