Amazon.com (NASDAQ:AMZN) is shutting down its restaurant delivery services in the United States, ending nearly four years of efforts to crack the market currently dominated by Grubhub (NYSE:GRUB), DoorDash, and Uber (NYSE:UBER) Eats. It will also shut down Daily Dish, the workplace lunch delivery service it launched in 2016.

Amazon already shut down its U.K. restaurant delivery services last year, so its stateside exit wasn't surprising. However, Amazon retains a stake in the meal delivery market via its investment in Deliveroo, a British company that serves meals in over 200 cities worldwide.

Amazon's decision to ax its own first-party services while staying invested through a start-up raises an interesting question: Why doesn't it just buy Grubhub instead? I'm not saying that takeover will happen, but it makes sense for five simple reasons. They are:

1. Instant market leadership

Grubhub and DoorDash are the two largest meal delivery services in the U.S. Grubhub and its subsidiaries controlled 32% of the market in April, according to Second Measure, followed by DoorDash's 29% share, Uber Eats' 22% share, and Postmates' 10% share. The remaining 7% slice was split among smaller players like Amazon Restaurants and Square's Caviar.

Grubhub expanded over the past few years by gobbling up smaller rivals like MenuPages, Allmenus, Delivered Dish, LAbite, Yelp's Eat24,  and Tapingo. Grubhub has already consolidated a large portion of the market, and Amazon would instantly become the market leader with a buyout.

Amazon would also gain Grubhub's big restaurant partnerships, including its deals with The Cheesecake Factory and Yum Brands. The integration of those meal orders would expand Amazon's e-commerce ecosystem, give restaurants more online exposure, and significantly widen Grubhub's moat against DoorDash and Uber.

2. Prime ecosystem expansion

When Amazon launched Amazon Restaurants in 2015, it offered one-hour meal deliveries as a perk to Prime members. However, customers clearly still preferred ordering meals from Grubhub and its peers.

Meal delivery services aren't cheap, and Grubhub's fees are generally higher than the fees at DoorDash and Uber Eats. If Amazon acquires Grubhub, it could bundle discounted (or even free) meal deliveries into its Prime subscription plans. Amazon would take a loss on every delivery, but those lower fees could marginalize DoorDash, Uber Eats, and Postmates.

Amazon could also use Grubhub's delivery platform as a loss leader to lock in or gain more Prime subscribers. Amazon already has over 100 million Prime subscribers in the U.S., and maintaining that massive customer base shores up its defenses against retail rivals like Walmart and Target. Furthermore, Grubhub is already integrated with Alexa so Amazon could simply tweak the voice assistant to make the platform the default choice for ordering meals.

3. Synergies with Amazon Flex

Back in 2015, Amazon launched Amazon Flex, an Uber-like service that lets individuals deliver packages for Amazon with their own vehicles. Roughly 11,000 Flex drivers worked for Amazon as independent contractors at the end of 2018. Flex drivers, like Uber and Lyft drivers, recently started demanding more benefits reserved for full-time employees.

Grubhub doesn't disclose its total number of drivers, but over 7,000 drivers filed a class action lawsuit against the company to be classified as employees instead of independent contractors in 2017. In other words, Amazon and Grubhub face similar problems.

If Amazon combines these two delivery platforms, it would gain a much larger pool of drivers who could get both packages and meals to consumers. Though it could still face demands for full-time employee benefits, its larger scale could mitigate the impact of protests or strikes. A wider delivery network could also help Amazon fulfill its goal of expanding one- and two-hour Whole Foods deliveries to more markets.

4. Marketing and logistics costs savings

Grubhub's earnings tumbled in recent quarters as its marketing and logistics costs surged. Much of that spending was aimed at countering DoorDash and Uber Eats.

This might make Grubhub seem like a potential money pit for Amazon, but those costs would decline significantly if Amazon integrates its platform into its own ecosystem. Instead of buying digital and TV ads, Amazon could simply advertise Grubhub on its internal advertising network, which is now the third-largest digital ad platform in the U.S. Amazon could also cut logistics costs by merging the two companies' delivery platforms and eliminating redundancies.

5. A reasonable price tag

Grubhub trades at just over 30 times forward earnings and an enterprise value of about $6 billion. DoorDash, which has yet to go public, has a whopping valuation of $12.6 billion and isn't even profitable like Grubhub. Therefore, it makes sense for Amazon to buy the market leader at a discount to the red-hot underdog.

I personally own shares of Amazon and Grubhub, and I'm not trying to spark any buyout rumors. But it wouldn't surprise me if a takeover by Amazon happens, since it sounds more logical than its recent interest in Boost Mobile.

This article originally appeared in The Motley Fool.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Leo Sun owns shares of Amazon, Grubhub, and Square. The Motley Fool owns shares of and recommends Amazon and Square. The Motley Fool recommends Grubhub, Uber Technologies, and Yelp. The Motley Fool has a disclosure policy.