Over long periods of time, investing in stocks can lead to magnificent gains. That's exactly what Costco (COST 1.44%) has done for its investors.

In the past 30 years, shares have returned 13,300%, including dividends. That gain would have turned a $10,000 investment into more than $1.3 million today (as of April 16). This performance absolutely crushes the S&P 500.

To gain a better appreciation for what Costco has accomplished for investors, it's worthwhile to look at its history. Then, with a fresh perspective, we can determine if this unstoppable retail stock makes for a no-brainer buy right now.

Scaling up the business

Costco's business model hasn't changed over the years. About 30 years ago, the company operated 200 warehouse locations, generating $15 billion of net sales in fiscal 1993. Costco currently has 876 warehouses open, raking in $238 billion in net sales in fiscal 2023.

This has been a story about a business that has scaled up its operations in a tremendous fashion. Three decades ago, the company's executive team figured out that low prices on high-quality merchandise in a no-frills shopping environment are what every customer wanted. So, they invested aggressively in expanding domestically and internationally. It's a repeatable and proven playbook that is still in force today.

The result of this strategy has been rising sales and earnings. This business is consistently profitable, giving it the ability to pay one-time special dividends every few years. The most recent payout of $15 per share was announced last December, boosting investor returns.

Costco is currently the world's third biggest retailer, behind only Walmart and Amazon. It has 73 million member households that pay annual fees to have the right to shop at the company's warehouses. This helps generate a predictable and recurring high-margin revenue stream.

A company that has become as dominant as Costco benefits from some competitive strengths. In this case, the business possesses a powerful scale advantage. Because it buys merchandise in such massive quantities, it is able to obtain favorable pricing on goods, savings that are constantly passed on to customers.

Even with the rise of online shopping, Costco has been able to open new locations, grow revenue and net income, and add new members. This makes me believe that the company's competitive position is insulated from the threat of disruption, whatever that may look like.

Past results don't resemble forward returns

As of this writing, Costco carries a market cap of $316 billion, which makes it the world's 29th most valuable business. Add this to its monster sales base, and I'm positive that forward returns aren't going to come anywhere near what they've reached in the past.

There's still growth potential. Costco was able to open 23 net new warehouses in fiscal 2023, with management expecting 28 more in  the current fiscal year. According to Wall Street consensus analyst estimates, the company is projected to grow revenue at 6% per year on average over the next three years.

These would still be healthy gains. But it's safe to say that Costco's expansion potential isn't as large as it once was.

The valuation is also worrying. Shares trade at a price-to-earnings ratio of 46.6. They've rarely been more expensive in the last 20 years. While the business has a dominant position in the retail sector, the stock is likely to disappoint going forward given its nosebleed price tag.

It would be easy to argue that paying that type of valuation makes sense. However, that's only if you believe Costco will be able to grow at a faster clip in the next five to 10 years than it did in the past. I just don't think that's a probable outcome. Therefore, I'm not a buyer of the stock right now.