McDonald's (NYSE:MCD) owned a piece of Chipotle (NYSE:CMG) until 2006, when it sold its 90% stake in the subsidiary company that controlled the Mexican chain for $1.5 billion.

That was actually a pretty good return on the burger-and-fries company's $360 million total investment, according to figures from Bloomberg. But even with the chain's recent struggles due to its E. coli/food safety scandal, it was clearly a case of McDonald's selling too soon.

"I think McDonald's had such a huge system that they thought Chipotle could never be meaningful enough when they sold it off," Lynne Collier, a managing director with Sterne Agee told Bloomberg in October 2013. "It turns out Chipotle is probably the best restaurant brand created in 10 or 15 years, with the best growth and profit metrics in the industry. I do think about how it could have been for McDonald's had they kept it."

Of course, Chipotle in 2013 had not yet fallen from grace, but its current $11.56 billion market cap certainly dwarfs what the chain was worth when McDonald's cashed out. Now, both companies are facing significant hurdles. McDonald's saw its U.S. comparable-store sales slump in Q4, dropping 1.3%. Chipotle has seen its overall business struggle to recover from the major hits it took after its E. coli scandal, which began in July 2015 but really kicked with a nine-state outbreak in October of that year.

Deciding which stock represents a better buy is largely dependent on how you view each chain's efforts to tackle its problems. In addition, it's also worth considering how each company's share price has performed in relation to their respective problems.

CMG Chart

Image source: YCharts.com.

Can Chipotle fully recover?

Since its food-safety scandal, Chipotle has tried to take visible steps to show customers it was taking the issue seriously. That included changing food-handling procedures and taking the bold step of closing the chain's stores for an afternoon to train staff. Aside from trying to convince people that its restaurants are safe, Chipotle has also been working to improve the experience in its restaurants.

This has included improving its app-based ordering system and putting a second production line in many of its restaurants to handle those orders. The Mexican chain also recently launched "Smarter Pickup Times," a system that gives customers more accurate pickup times for digitally ordered food. In theory, this "improves the company's ability to process more digital orders without disrupting service or throughput in its restaurants," according to a press release.

The problem for Chipotle is that consumers have not been very forgiving. Sales for 2016 fell 13.3% to $3.9 billion, with comparable-restaurant sales decreasing 20.4%. There were some signs of life in Q4, where comparable sales dropped 4.8% for the full quarter, but gained 14.7% in December. That, of course, was aided by December being a month at the height of the E. coli scandal a year ago.

A line at a Chipotle

Chipotle is hoping technology can lead to shorter lines in its stores. Image source: Chipotle.

Can McDonald's grow in the U.S.?

McDonald's does not have a food safety problem, but it has struggled to grow, especially in its home market. All-day breakfast helped turn that around for a while, but the chain faces the same problems that have dogged it for years: Its core menu is generally not good for you, and it's not the same quality as the food at fast-casual rivals like Chipotle.

To keep growing, McDonald's CEO Steve Easterbrook laid out an ambitious plan in March that was heavy on technology. The company plans to not only make changes in its app similar to Chipotle's mobile ordering capability, it also plans to add kiosk-based ordering in its stores and modernize the drive through experience.

"To deliver sustained growth, we have to attract more customers, more often," said Easterbrook. "Our greatest opportunities reside at the very heart of our brand -- our food, value and the customer experience."

On the food side, the company has been leaning on its staples by trying to introduce the Big Mac to young customers, many of whom have never tried the iconic sandwich. In addition, the chain sees its McCafe beverage brand as a growth driver, and it has been using heavy discounting to get consumers to sample its coffees, frozen drinks, and other beverages.

Which stock is a better buy?

It has taken Chipotle a surprisingly long time to recover from its food-safety issues, but I remain convinced that a recovery will happen. People abandoned the chain because they feared they would get sick, and in the time they were away, some found other places to eat (or learned they could eat at home). That's a situation Chipotle has addressed with increased advertising and the technology changes it's making to get people in and out of its restaurants faster.

Ultimately, because of the quality of its food, Chipotle will find its audience, and in the next year, because it will be facing easy comps, it should post major sales gains. That will eventually raise its stock back to its former heights -- or perhaps even higher.

McDonald's will likely be able to grow, even in the U.S., because it knows how to maximize its customer base, and its technology expansion will do that. In addition, the chain could gain some share with McCafe, though that's hardly a sure thing. Chipotle, though, simply has an easier path to growth, and that makes it a better buy. 

Daniel Kline has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Chipotle Mexican Grill. The Motley Fool has a disclosure policy.