The non-profit owns the for-profit and thus any profit.
The non-profit Mozilla Foundation has a wholly owned for-profit subsidiary Mozilla Corporation which makes Firefox.
In theory, this opens up avenues for revenue generation since the for-profit can engage in activities beyond the goals of the non-profit.
It also opens up avenues for revenue based compensation for employees. Non-profits have some legal “reasonableness” tests for compensation that for-profits do not. If the for-profit subsidiary starts raking in huge new revenue it can decide to distribute it to the employees rather than the parent non-profit.
Non-profits come with administrative overheads so they may use a for profit subsidiary to remove those, in the hope of greater overall revenue for the non-profit.
Despite these valid reasons, many feel that Mozilla has no good justification for it and the true beneficiaries of Mozilla Corporation’s status are their executives, not Mozilla Foundation.
Non-profits can be “abused” without needing a subsidiary. Some spend 90% of revenue on expenses and administration and give little to a cause.
It sounds egregious but may not always be. Imagine a couple with a non-profit that’s basically a well regarded website forum to promote understanding of a medical cause. The forum requires a lot of moderation due to trolls. It has revenues of $60k but distributes it all as salary to the two staff.