That is incorrect. Any company must act in the best interest of its shareholders. A publicly-traded company must maximize profit because that's the implicit nature of it: I buy stock in the market because I want a return on my investment. But if all shareholders of a given company (say, Mozilla) want to produce something for the good of the Internet and not make a profit, that's up to the shareholders.
A "non-profit" status simply gives the organization certain tax advantages because the state understands that the organization is acting on the best interest of the community, rather than its shareholders. But if a for-profit wants to do the same and not take advantage of said tax benefits, that's up to the shareholders to decide.