Investors love warehouse chain Costco Wholesale (COST 1.01%), and for good reason. This well-managed business consistently keeps its prices low for its members in spite of inflationary headwinds. And for its efforts, it's rewarded with loyalty from its members and high-margin recurring revenue from its membership fees.

This consistent source of profits allows Costco's management to reward shareholders on a regular basis. One of its preferred methods is paying a growing dividend. It's paid and increased its dividend for 19 straight years, and I expect this streak to continue for decades to come.

But if there's one knock on Costco stock, it's its valuation -- the stock is expensive. At 50 times trailing earnings right now, Costco shares trade at almost a 50% premium to the 10-year average for their valuation, as the chart below shows.

COST PE Ratio Chart

COST PE Ratio data by YCharts

The late great Charlie Munger loved Costco stock, which was one of only three stocks in his personal portfolio. But even he bemoaned its valuation.

What's to like about BJ's stock?

This is why I want to highlight BJ's Wholesale Club (BJ 0.35%) stock. It offers investors many of the exact same benefits of Costco stock but is a better bargain by a mile. Considering the business model is membership-based, an investment thesis for BJ's Wholesale Club revolves around its ability to gain and retain members.

Since this is the core issue for a BJ's investment, shareholders should be encouraged. When BJ's went public in early 2018, it had more than 5 million paid memberships. Now it has more than 7 million as of the end of its fiscal 2023.

BJ's hasn't just found new members; it's retained old ones as well. The company's renewal rate in 2023 was 90%. For perspective, Costco's renewal rate in its most recent quarter was only marginally better at 93%.

To retain members, both clubs must provide value to their shoppers -- it's the whole reason someone would pay to shop there in the first place. One of the ways BJ's seems to be providing value to its members is through its privately owned brands. In 2017, 19% of its sales came from its own line. But in 2023, the penetration rate was nearly 26%.

Long term, BJ's management believes its privately owned brands can hit 30% of sales. This should provide value for members and consequently spur ongoing high renewal rates.

BJ's isn't only retaining members at existing stores. It's also opening up new locations at a modest pace. As of the end of 2023, it has 244 club locations, and it intends to open 12 new locations this year. For what it's worth, Costco has nearly 900 locations, which suggests that BJ's could grow for quite some time at its current pace.

Under its business model, membership fees are basically pure profit for BJ's. In its fiscal 2023, the company had full-year net income of $524 million. But its membership-fee revenue was $421 million, providing the bulk of this profit. Therefore, simply growing its membership base as it's doing will provide the earnings growth that shareholders need to see.

Should investors buy BJ's stock?

I'm not going as far as to say that BJ's is a better business than Costco -- Costco is undoubtedly among the very best. But BJ's is a good business nonetheless. And its valuation is far more reasonable, which is why I believe it's the better buy.

COST PE Ratio Chart

COST PE Ratio data by YCharts

Warren Buffett says that having a margin of safety is "the cornerstone of investment success." In a nutshell, he means it's important to buy stocks that are undervalued and avoid those that are overvalued.

With Costco stock trading at a 50% premium to its long-term average valuation, I believe that it is easily overvalued today for those looking to start a position. Therefore, I'd say that there's no margin of safety with Costco stock.

By contrast, BJ's stock trades at a reasonable valuation -- perhaps not grossly undervalued, but reasonable. Consequently, I believe it's the safer stock. And I believe that the chance of market-beating returns is much higher given its cheaper starting point.

BJ's still needs to grow its membership base long term -- this is the most important part of the investment thesis, and investors can't get caught up entirely with valuation metrics. But as I've explained, paid memberships at BJ's are trending in the right direction, making it a good buy today.