True, but you still bet your future and work many many hours for no pay, and in some cases it never even gets seed funding, so you end up just wasting a ton of time, even though no one profited from your work.
Also it should be mentioned for young/inexperienced people, that you do this only if the equity is significant (don't join if they have 5 non technical founders, no product and offer you like 5%), and if the founders are not idiots, assholes and/or dodgy.