If you're a fan of stocks trading at discounts, you've likely taken notice of both McDonald's (MCD -0.91%) and Starbucks (SBUX 0.47%) shares recently. The two successful restaurant operators have seen their stocks slump since August and are both down nearly 10% on the year. The S&P 500, in contrast, is up 13% so far in 2023.

That performance alone suggests that investors could enjoy solid returns by putting either company in their portfolio. There are some big differences in the businesses' operating trends and financial positions, though. So, which one is the better buy right now?

The sales matchup

Both companies are increasing sales at a solid clip, with McDonald's boasting a slight edge on growth. The fast-food giant's comparable-store sales were up 12% this past quarter, marking only a modest slowdown from the prior quarter's 13% spike. Consumers are enjoying McDonald's improved service and its focus on value at a time when inflation is pinching many people's budgets.

Starbucks is no slouch in this department, either. Comps were up 10% last quarter thanks to a healthy mix of rising traffic and increased average spending. Overall sales rose 12% to cross a record $9 billion.

Profit margins are rising

Neither company is having trouble passing along higher prices to customers, either. McDonald's operating profit margin is sitting at a record high of nearly 46% of sales, in fact. Starbucks, which doesn't rely nearly as much on franchising, is also close to record profitability thanks to a combination of rising prices, cost cuts, and stronger sales.

MCD Operating Margin (TTM) Chart

MCD Operating Margin (TTM) data by YCharts

McDonald's again wins in this direct matchup thanks to its massive global sales base and its steady stream of franchise, royalty, and real estate fees. However, Starbucks' expanding profit margin in recent quarters is a testament to its market strength as well. "I am confident in the multiple paths available for the company to drive significant growth and margin improvement," CEO Laxman Narasimhan told investors in early August.

Risks and pricing

You might be wondering why the two stocks are slumping this year despite all this good news. Wall Street is worried about slowing growth ahead due to weaker consumer spending patterns and the end of the latest rounds of price increases.

McDonald's executives said in July that the selling environment was getting more challenging. "Costs remain elevated, consumer discretionary spending is limited, and industry traffic is pressured," they told investors in a recent conference call as they predicted that revenue growth will decelerate in the second half of 2023. Starbucks is likely to face many of the same pressures.

Luckily, this pessimism is reflected in the stocks' valuations today. McDonald's shares are priced at just 7.5 times annual sales right now, down from nearly 10 times sales back in May. Starbucks is priced at 3 times revenue, down from 4 times a few months ago.

While either stock is likely to see positive long-term returns from here, McDonald's seems well worth the premium compared to Starbucks. Its faster growth and much higher profitability provide flexibility during what could be a tough operating environment in 2024.

McDonald's shareholders also receive a higher-yielding dividend that has a much longer track record of steady annual raises. And choosing to automatically reinvest those quarterly payouts can amplify your returns by allowing you to accumulate more shares when the fast-food stock is cheaper -- as it is right now.