Don’t let attractive yields on cash lull you into staying on the sidelines. Over the long term, stocks are the way to grow wealth, according to Bank of America. Some $5.43 trillion is in money market funds, as of the week ending June 21 , according to the Investment Company Institute. Retail investors account for $1.99 trillion of that sum. Who could blame them? The Crane 100 Money Fund index has an annualized seven-day current yield of 4.93% as of June 26. As sweet as that yield may be right now, stocks are the one asset class that can help investors counter the corrosive effect of inflation. “Over the post-war era stretching from 1945 to 2022, the S & P 500 has handily outperformed other asset classes, posting annualized total returns of 11.2%,” Lauren Sanfilippo, senior investment strategist at Bank of America, wrote in a Tuesday note. That compares to average annual gains of 5.7% for corporate credit, 5.1% for government bonds and 3.8% for cash. Meanwhile, inflation averaged at 3.7% annually during that period. “That’s another way of saying that the S & P 500 is one of the world’s best wealth-generating machines ever constructed,” she added. Further, financial crises tend to be followed by economic and earnings growth cycles, along with sustained price gains for stocks. In particular, Sanfilippo said drivers of the new cycle will include “accelerating adoption” of generative artificial intelligence, a push for a greener future and “the coming capital expenditures boom” in semiconductors. The firm expects greater rebalancing toward equities over the approaching quarter, she said. “All of the above are powerful structural forces for future long-term earnings growth — and key reasons not to rebalance too far in the direction of money market funds,” Sanfilippo wrote. — CNBC’s Michael Bloom contributed to this report.