When you're subject to capital gains taxation, the government shares in some of the upside, but when you have capital losses, the government shares in the downside too1. Because of this, the actual risk (and reward) of any given portfolio is lower than it seems. To counteract this, you should consider shifting your allocation toward riskier assets.
This was new to me, but you can find articles on this subject going all the way back to "Proportional Income Taxation and Risk-Taking" by Evsey D. Domar and Richard A. Musgrave in 1944.
The Mathematical Framework
Take a tax rate, like the 20% long term capital gains rate in the United States. For any investment subject to this tax, the gains are 20% lower than they would be without the tax, but the losses are 20% lower as well (so 80% of what you would naively expect). To increase that back to 100% of the desired risk/return, we just need to increase both risk and reward by 25% (1 / 0.8 = 1.25).
For short-term gains taxed at ordinary income rates (potentially 37%+), the effect is even stronger. The optimal risk increase would be approximately 59% (1/(1-0.37) = 1.59).
Practical Implications
This is unfortunately complicated. The straightforward takeaway is that if your 60/40 stock/bond portfolio is subject to the 20% long-term capital gains tax, you should increase the stock by 25% and shift to 75/25. This isn't exactly right though, since the two assets differ in more ways than their risk profile. My best guess is that stock's tax-advantaged treatment in other ways make the 60->75 optimal shift an underestimate2, but maybe don't change how you invest your life savings without more research.
Conclusion
The tax code's treatment of capital gains and losses means that it's rational for investors to take increased risk than they would without taxes, since the government will share in both the gains and the losses.
If you have capital losses, you can use those to offset capital gains, which reduces their "badness" by the capital gains tax rate. For example, if you have $100 of capital losses, at some point you will be able to apply those to cancel $100 of gains and avoid $20 in taxes, so in some sense you've only really lost $80. But yes, this oversimplies somewhat. ↩
Stocks are subject to the 20% long-term capital gains tax, but bond income is subject to ordinary income tax. The latter is much higher, so even without the risk discussion above, you should have a higher allocation to stocks than you might expect. ↩