Investing in the stock market has been an incredible vehicle for wealth-building for Americans for decades. Not all investments yield the same results, which is why for many investors, it makes sense to set aside a portion of your portfolio to invest in market-tracking index funds and exchange-traded funds (ETFs) and benefit from the market's overall rise.

Some single stock investments have made millionaires, and others can still be valuable for balancing risk. If you had invested $1,000 in Bank of America (BAC -0.19%) stock five years ago, where would it be today?

One of Buffett's favorite stocks

Bank of America, or BofA, is the second-largest U.S. bank by assets and one of Warren Buffett's favorite stocks. It accounts for 10.1% of Berkshire Hathaway's equity portfolio, making it its second-largest position.

Buffett loves bank stocks, but BofA is his favorite. Banks have a lot of cash, which in general provides stability and gives them the opportunity to fund ventures and loans and create the cycle of economic growth. It also funds dividends, which many banks pay, and which creates shareholder value. Banks aren't usually growth stocks, and the dividend makes them attractive for passive income.

The big reveal

That leads up to the answer to the headline question, which might surprise investors. If you'd invested $1,000 in Bank of America stock five years, ago, you'd have $1,313 today, dividends included. That trails the S&P 500 by a wide margin.

^SPX Chart

^SPX data by YCharts

As you'll notice from the chart, the wide divergence is a recent development. At several points during the past 10 years, BofA stock has matched or surpassed the broader market.

Five years might be a while, but holding for a decade or several is where investors get to experience the magic of compounding and the value of holding established blue chip leaders.

Not all banks are stable, as illustrated by the collapse of several mid-sized regional banks last year. That's why Buffett loves BofA, which is large, secure, and consumer-centric. These factors create lower risk and offer benefits beyond a market-beating performance.