While both Costco (COST 0.17%) and TJX Companies (TJX 0.83%) can be considered "discount" retailers and both derive at least a portion of their sales from selling clothing, the two companies are fundamentally different. One has become a leader in membership-based warehouse retailing, while the other specializes in helping customers access off-price apparel and home goods.

The two operations do share one intriguing commonality. With a constantly shifting array of merchandise, both retailers explicitly promote a "treasure hunt" experience in their stores. This can serve as a competitive advantage as it gives customers a reason to repeatedly visit the physical stores.

Investors tend to focus on a different kind of treasure hunting, and the critical question for them is which retail stock offers more potential for gains. Let's take a closer look at these two companies to see which one is the better buy.

Young man in mask shopping for clothes.

Image source: Getty Images.

The state of Costco

Costco operates approximately 800 warehouse stores in 12 countries. Its 105.5 million members purchased $163.2 billion worth of goods from the retailer in fiscal 2020 (which ended Aug. 30).

Costco outsells direct competitors such as Walmart's Sam's Club and BJ's Wholesale. It has also held its own against the competitive e-commerce onslaught from Amazon.

It has succeeded with a strategy of charging a membership fee while offering customers high-quality merchandise at low-margin prices. This fee, which starts at $60 per year, comprises the majority of the company's yearly profits.

Authorities in most of its markets also deemed Costco an "essential" retailer. This has helped the company not only to stay open but boost sales throughout the COVID-19 pandemic.

Costco stock price has gained 32% year-to-date. That price jump has taken the company's forward price-to-earnings (P/E) ratio to almost 40.

COST Chart

COST data by YCharts

For the most recent quarter, net sales rose 12.5% from year-ago levels. This led to a 27% increase in net income per diluted share over the same period.

Moreover, analysts expect earnings to grow by almost 11% this year. This puts Costco on track to maintain double-digit growth for the foreseeable future as it adds members and expands into new markets.

How TJX fares

TJX encompasses 4,500 locations in nine countries. It operates under multiple retail brands, including T.J. Maxx, Marshall's, HomeGoods, and Sierra.

These stores typically sell merchandise at between 20% and 60% off the retail price. The company also works with over 21,000 vendors in more than 100 countries. TJX keeps its selection up to date with a team of 1,100 buyers who find the right fashions and brands as it tests different ideas.

Unlike Costco, TJX was forced to deal with store closures during the pandemic. This may explain why the stock price fell by almost 13% in 2020. Still, at a forward P/E ratio of 21, it trades at a significant discount to Costco.

TJX Chart

TJX data by YCharts

In the last reported quarter, which ended Aug. 1, revenue fell by 32% while company profits declined to a loss of $0.18 per share. 

However, analysts forecast a return to profitability in the upcoming quarter. That is not the case for peers such as Kohl's and Macy's. Moreover, even though analysts expect revenue to decline in the near term, they believe TJX will return to profitability by next quarter.

Costco or TJX?

Although TJX has positioned itself to perform better than other apparel retailers, Costco will more likely bring higher investor returns for the near future. Yes, its valuation is much higher. However, COVID-19 cases have again spiked in the U.S. and in other parts of the world. Should parts of the country return to lockdown, Costco will fare better.

Longer-term, Costco's more diverse choice of merchandise and its membership-oriented business model can provide a one-stop-shop for its customers. This also gives Costco a competitive moat that a retailer like TJX does not have. Though TJX should survive, Costco is the company more likely to bring investors more treasure right now.