Here is an example,
@bookem dano . Suppose in 2025 you are single and make $50k after deductions (meaning your income was at least $65k since the standard deduction is $15k for single filers). Suppose you do have those capital gains that you talk about in the regular market. Then you'd be at a 15% long term capital gains tax bracket. Meaning, you'd pay 15% tax on all your long term market gains this year.
Now suppose you pop $2k extra into a 401k. Your income is now $48k. That puts you into the 0% long-term capital gains bracket (single filers with under $48,350 income after deductions).
Bingo, all long-term capital gains are tax free this year for you just for putting extra into the 401k.
The more that you max out the 401k, the more it opens up more doors like that one.