2020 has been a great year for Costco (COST -0.55%). While much of the global economy came to a screeching halt, companies like Costco and Walmart (WMT -0.65%) that provide people with the essentials experienced skyrocketing sales in their basic categories. Restaurant chains were less lucky. Lockdowns required their dining rooms to close, and while many kept offering takeout and delivery, a lot of U.S. consumers were saving their disposable income for more pressing concerns.

But McDonald's (MCD 0.38%) too, has been displaying its might during the past few months, serving customers via its drive-thru and digital channels. While its sales were down, they're creeping back up as customers return to names they know and trust. In light of all this, is Costco or McDonald's a better buy today?

Bringing food to the table

Costco's bread and butter is actually bread and butter, and other groceries, which it sells to its members. The chain differs from traditional supermarkets in three main ways. First, the company sells products in a range of other segments such as travel, clothing, and appliances, and some of its stores have optical labs and pharmacies. Second, the huge warehouse stores sell items primarily in bulk quantities. Third and most importantly, to shop there, people must pay the company an annual fee of $60 for a standard membership or $120 for an executive membership.

Woman putting groceries into her car trunk.

Image source: Getty Images.

These fees accounted for $815 million of its third-quarter revenue, or almost a quarter of the total. They're the solid foundation that underlays the company's business, and which allow it to sell goods at margins much lower than those of a typical supermarket. The number of people willing to pay those fees to access the high savings continues to grow: Costco added 500,000 net new members in Q3, and reported a 5% year-over-year increase in membership fee income. And the bulk-purchasing model means high revenues for the retailer.

Costco's digital business is also flying: Sales via its e-commerce channel grew 64% in the third quarter. The company reports monthly sales, and lest you think the surge in its business has calmed down in the months since more of the U.S. economy began to reopen, sales  were up 11% year over year in June, 14% in July, and 15% in August.

Going out to eat

McDonald's was relatively well-equipped to handle the social-distancing requirements of the pandemic, as it has decades of experience in operating drive-thrus. 

"Our unmatched drive-thru penetration has allowed us to continue serving more customers in more markets than anyone else," said CEO Chris Kempczinski. It's also operationally efficient -- it made modifications to 30,000 restaurants and closed another 9,000 to conform to government mandates amid the crisis. Customers appear to have appreciated its efforts; its customer satisfaction scores have increased over the past few months. 

Burger, fries, and Cola.

Image source: Getty Images.

McDonald's is now focused on its three "D"s: drive-thru, delivery, and digital. Drive-thru provided 90% of its sales in the second quarter, and volumes for delivery and digital both increased. The company is looking to leverage its strong position in the fast-food industry to expand its digital success.

Despite a large revenue decline, McDonald's reported earnings of $0.65 per share for the second quarter, and July comps were already positive and trending upwards.

Let's compare the companies' sales growth over the past five quarters.

Company YOY sales growth Q3/Q2 Q2/Q1 Q1/Q4 Q4/Q3 Q3/Q2
Costco 7.3% 10.5% 5.6% 7% 7.4%
McDonald's (30%) (6%) 4% 1% 0%

Data source: McDonald's and Costco quarterly reports. McDonald's fiscal calendar follows the calendar year. Costco's quarters are offset from that by approximately one quarter; its 2020 fiscal third quarter ended May 10. For McDonald's, sales refers to consolidated revenue. YOY = year over year.

Costco's sales grow more than McDonald's in general. But in the economic crisis, the bulk-buy giant really showed its strengths.

How have their stocks performed?

While both companies are up year-to-date, Costco has returned 15%, while McDonald's is up 7% as of this writing. But over the past three years, Costco's share price compounded 28% annually while McDonald's was a more modest 11%, excluding dividends. McDonald's dividend, though, today yields 2.3%, while Costco's only yields 1%. However, it's worth noting that Costco pays special dividends on occasion -- the last two were for $7 each, in 2017 and again in 2018. Given that is has extra cash on hand these days, there's a strong possibility that it will soon distribute another one. And while past performance isn't guaranteed to continue in the future, there's every reason to believe that Costco will keep up its fantastic sales growth, and that its share price will rise accordingly. Costco is the better buy today.