You seem to be blurring the line between "the company is profitable" and "I (an individual) am profitable." It's certainly possible for the company to be profitable in a narrow sense (which can be an important bit of information) while you (the founder) as an individual are not.
But since a founder owns equity which he/she expects to become valuable in the future, it's a tradeoff some people choose to make - forgoing a salary now, so the company can thrive.
Perhaps the downvoters would like to explain their logic here? If a worker chooses to donate his/her time to the company, how is that a cost for the company? Again, there is a distinction between the finances of the company and the finances of the individual involved. It's entirely reasonable, for example, for a founder to "donate" his/her time to the company, because he/she expects to gain from their equity stake in the future.
But since a founder owns equity which he/she expects to become valuable in the future, it's a tradeoff some people choose to make - forgoing a salary now, so the company can thrive.