Five years ago Square (NYSE:SQ) bought food delivery service Caviar for $44.3 million. At the time, Square CEO Jack Dorsey declared that "Caviar's curated, seamless delivery experience is exactly the kind of service we want to provide buyers and sellers."

Fast forward to Square's recent second-quarter earnings report, and the company just announced that it would sell Caviar to DoorDash for $410 million. The sale nets Square a nice profit, but why is it divesting this once-promising business?

A courier delivers food.

Image source: Getty Images.

Caviar was destined to disappear

Square initially bought Caviar to expand its ecosystem beyond digital payments. That ecosystem -- which now includes the e-commerce services platform Weebly, its Square Capital lending arm, Instant Deposit services for sellers, its Cash App, and more -- locks in merchants and consumers.

But Caviar never gained much ground in the crowded food delivery market. Four services -- DoorDash, Grubhub (NYSE:GRUB), Uber (NYSE:UBER) Eats, and Postmates -- controlled 94% of the U.S. food delivery market in June, according to Second Measure.

Everyone else, including Caviar and Amazon's (NASDAQ:AMZN) recently shuttered meal delivery platform, clashed over the remaining sliver. If even Amazon failed to gain ground with the support of Whole Foods and its e-commerce ecosystem, it seemed unlikely that Caviar could succeed. Selling Caviar could also help Square sidestep the recent PR debacles regarding tips, hidden fees, and misbehaving couriers which have plagued the market leaders.

But what about Zesty and Square for Restaurants?

Square's retreat from the meal delivery market is reasonable, but the company has sent investors mixed signals over the past few years. In 2016 Bloomberg claimed that Square was in talks to sell Caviar to Grubhub, Uber, or Yelp. But in 2018 the company seemed to double down on Caviar by acquiring corporate catering start-up Zesty and launching Square for Restaurants.

Prepared meals on a table.

Image source: Caviar.

Square integrated Zesty's assets into Caviar for Teams, which expanded the service into the corporate catering market. Square for Restaurants, which bundled Caviar with its other payment and analytics services, targeted similar all-in-one platforms like Grubhub.

It's unclear if Square will retain Zesty's services or transfer them over to DoorDash. However, Square plans to keep running Square for Restaurants, which is already integrated with Caviar, DoorDash, and Postmates. During the conference call, Dorsey noted that Square for Restaurants and Square for Retail were both attracting "a number of larger sellers."

Square is selling Caviar to DoorDash for a mix of cash and preferred DoorDash shares. So as an investor, Square can still profit from DoorDash's growth, while eliminating its exposure to the low-margin food delivery market. Caviar and DoorDash are already integrated into the Cash App, so DoorDash's expansion could also support Cash's market growth.

Is this good news for Square's investors?

During the conference call, CFO Amrita Ahuja noted that Caviar had a "lower gross margin profile" than its other subscription and services, with courier fees and revenue-sharing deals with restaurants accounting for the "largest component" of the unit's costs.

Ahuja noted that Caviar was the second largest component of its subscription and services revenue, which rose 87% annually to $251 million during the second quarter. The Cash App generated the most revenue, and Square Capital ranked third. Ahuja stated that Square would update its guidance after closing the deal.

Removing Caviar from that mix will temporarily throttle Square's subscription and services revenue growth, but improve the unit's profitability. Dorsey noted that the sale would enable Square to make additional investments and strengthen its core payments business, which could widen its moat against rivals like PayPal.

All things considered, Square's decision to sell Caviar was a smart move. The company reaped a handsome profit from the deal, divested a lower-margin business, gained a stake in a high-growth start-up, and freed up more cash for investments in its core payment services.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.