You're wrong. If you only invested lump sums in the S&P 500 in 1998, 1999, 2005, and 2006, you'd have made money by today. Not as much as you would have historically, but still a fair chunk - and while yes, inflation would have eaten a large, large portion of it, it's way better than leaving your cash under your mattress.
There's no way you lost money if you were in the S&P 500, unless you were pulling it out of investments after crashes - in which case, duh, you're buying high and selling low, what did you expect?
And that's if you were only in the S&P 500... a more reasonable retirement portfolio is much more diversified, which would have increased your returns and lowered your volatility.