Shares of the world's largest fast-food chain, McDonald's (MCD), are sitting at all-time highs as of this writing, approaching $300 per share for the first time. The company had systemwide sales of $130 billion in 2023, which was a 10% year-over-year increase and a record high.

No wonder McDonald's stock is doing well.

Of course, there's a big difference in systemwide sales and revenue for McDonald's. The company had nearly 42,000 locations around the world as of the end of 2023. But 95% of these locations were franchised -- relatively few were company-owned.

At its restaurants, McDonald's sells hamburgers, french fries, milkshakes -- when the machine is working anyway, amirite? -- and more. But sales at franchised locations don't count as revenue for McDonald's. Therefore the company's full-year revenue of $25.5 billion is substantially lower than its systemwide sales of $130 billion.

Investors who dig a little deeper into its financial statements will find one further nuance to the numbers for McDonald's: In 2023, the company generated revenue of over $9.8 billion -- a whopping 38% of its total revenue -- from something that has nothing to do with its food.

McDonald's surprising revenue source

Franchisees for McDonald's are required to pay ongoing royalties and franchise fees for operating a McDonald's restaurant. But more than this, many franchisees are required to pay rent because McDonald's owns the real estate.

In other words, McDonald's isn't just a fast-food chain, it's also a real estate mogul. Franchisees pay royalties for selling food items such as McDoubles, McNuggets, and McFlurries. But they also must pay the McRent.

Typically, franchisees for McDonald's sign 20-year agreements for renting the buildings. That makes this revenue source for McDonald's incredibly resilient and it could be viewed as a competitive advantage.

At the end of the 20-year agreement, franchisees face a choice: Either they can sign a new agreement to continue using the building or McDonald's can put another franchisee in the space. Obviously, most franchisees choose to renew.

Not only is real estate a reliable revenue source for McDonald's, it's also an avenue for growth. In 2023, the company's rent revenue of $9.8 billion was up 9% from 2022. Indeed, this revenue source increases most years for McDonald's.

What it means for investors

When building an investment thesis -- an argument for why a stock can go up -- it's crucial to understand the details of the business structure. For example, Chipotle Mexican Grill owns and operates all of its U.S. locations. An investment thesis for Chipotle, therefore, will look quite different from McDonald's, which is 95% franchised and makes 38% of its money from real estate.

For McDonald's, it could have periods of waning and surging consumer demand for its food. Promotional items such as the McRib could stimulate excitement. Macroeconomic conditions could have people stay home.

But by and large, the financials for McDonald's will consistently keep trending higher because it's insulated from these concerns. It makes most of its money from franchise royalties and fees, as well as rent for its real estate.

Franchise revenue is high margin for McDonald's, allowing it to return plenty of cash to shareholders through stock buybacks and dividends.

For me, McDonald's isn't necessarily my stock pick for the highest upside over the next five years. However, McDonald's stock is one of my highest-conviction picks for positive shareholder returns over the next five years, due to the resiliency of its business model.