Over the years, investors have cashed in on retail success by buying shares of Costco (NASDAQ:COST) and Walmart (NYSE:WMT). Both companies continue to keep their registers ringing, even amid the competitive challenges coming from Amazon.

Consequently, investors will probably not find either of these stocks in the bargain bin. But that doesn't mean these stocks aren't still good buys.

Let's take a closer look at both companies to see which retail stock is likely to offer a better bargain for investors as we approach 2021.

The state of Costco

Costco remained a retail stalwart for its resilience. It has thrived with an ingenious business model, deriving the majority of its profits from membership fees. It also entices customers to visit repeatedly by selling an occasionally changing lineup of unique, high-quality products for a price barely above the cost of goods sold plus overhead. It has also become adept at omnichannel retailing, which leverages a combined in-store and online presence.

Man and woman with credit card on laptop

Image source: Getty Images.

Although it has faced some challenges, it has maintained net sales growth percentages in the mid- to high-single-digits for most of the last 10 years.

With warehouses in 45 states, it is beginning to reach a saturation point in the U.S. To maintain growth, it is starting to expand more into markets such as Europe, Asia, and Australia. In both fiscal 2020 and the latest quarter, net sales growth in its other international segment (which excludes Canada) exceeded that of the U.S. This indicates that Costco can maintain (or possibly increase) its growth pace for the foreseeable future.

Moreover, even amid the pandemic, diluted earnings per share in the most recent quarter grew by 38% from the same quarter last year. That was well above the 9% diluted EPS growth of the previous fiscal year. Admittedly, as growth falls back with the end of the pandemic, the forward price-to-earnings (P/E) ratio of about 37 could start to seem pricey. Nonetheless, while Costco stock does not sell at a discount, the potential for further upside should continue to make the stock a good deal for investors.

Where Walmart stands

Steady growth had become more of a struggle for Walmart. By the middle of the decade, Walmart growth had begun to stagnate and same-store sales had begun to turn negative at times in the middle of the 2010s.

However, the company has revived its fortunes in recent years as it invested heavily in online sales. More importantly, it copied other brick-and-mortar retailers by offering omnichannel shopping options. The result of these efforts helped e-commerce sales to rise by 79% in the latest quarter.

The new investment direction includes an international online approach. After a series of embarrassing retail failures internationally in previous decades, Walmart could get a second chance at success outside of North America. Much of this could hinge on Flipkart, the India-based online retailer it purchased.

Taking a page from Amazon's and Costco's playbooks, it also introduced a Walmart+ membership. This includes free shipping (with caveats) and deliveries and discounts on fuel.

Unfortunately, these moves have not translated into significant revenue and profit growth. For all of the hype about e-commerce and other new business lines, total revenue rose by less than 2% in fiscal 2020, which ended in January before the pandemic. The economic effects ofCOVID-19 has contributed to improved earnings for Walmart but also increased operational costs. In the nine months of fiscal 2021, revenue has risen by only 6.5% from the same nine-month period last year. Operating income did rise by 12% during that period. Nonetheless, the flat operating income growth in previous years indicates that this is likely a temporary boost.

Should operating income turn flat again, it could test investors' willingness to pay approximately 25 times forward earnings for this stock.

Costco or Walmart?

Although Costco stock is more expensive, it is the company more likely to offer a better buy to stock shoppers.

Walmart has revived itself through strategies such as omnichannel and a membership model. However, these are merely reactive moves to compete with Costco and Amazon. With revenue growth remaining modest, these moves are not ones likely to sustain investor interest long-term.

Conversely, Costco's strategy helps it to maintain significant sales growth under a variety of conditions. Moreover, with a more successful track record internationally, investors will probably cash in on Costco's growth for years to come.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.