Separately, the retailer this week began selling a wand that can read grocery barcodes and order household essentials. (Amazon chief executive Jeffrey Bezos owns The Washington Post.)
News of the deal sent shares of rival grocers plummeting as investors tried to digest the implications of an Amazon-backed grocery chain. SuperValu, with a network of 2,000 stores across the country, took one of the biggest hits, with a 14 percent drop Friday. Kroger, rumored late last year to be considering its own takeover of Whole Foods, was down 9 percent. (Shares of Whole Foods, meanwhile, soared nearly 30 percent; Amazon stock rose more than 2 percent.)
But some analysts say Amazon is likely to face significant challenges as it expands into a notoriously difficult business with low profit margins. Amazon and Whole Foods are very different businesses: One is a technology company that wins over customers with sophisticated algorithms and low prices. The other, nicknamed "Whole Paycheck," is known for the premiums it charges for specialty foods and its workplace culture that compensates cashiers and other staffers well. Both are led by hard-charging entrepreneurs who have spent decades turning their companies into iconic, multibillion-dollar businesses.
"To combine a company that specializes in high-end produce and specialty meats with a low-priced provider of everything - well, it's a complete contradiction," said Daniel Morgan, a senior portfolio manager at Synovus Trust, which owns Amazon shares. "If Amazon is going to buy something, why not a margin-booster like another cloud business that will actually bring profits?"
Morgan drew parallels with other big-name mergers, such as AOL's $165 billion takeover of Time Warner in 2000, which was also heralded for bringing together dot-com prowess and old-school know-how.
"Everybody applauded that deal and said it was the greatest deal ever," Morgan said. "And then suddenly it didn't work out - the cultures didn't fit, the business were completely different - and people started shaking their heads, saying, 'What were they thinking?' "
Amazon recently began experimenting with bookstores, but this is by far its most ambitious move into physical retail. The company - which last year accounted for one-third of U.S. online sales - was recently granted a patent for technology that would block shoppers from comparing prices from their mobile devices while they are in stores.
The Whole Foods deal signals a turning point for Amazon, after it struggled for years to break into the $800 billion U.S. grocery business. The company's decade-old AmazonFresh delivery service has been slow to take off, accounting for 0.8 percent of all grocery purchases last year. Walmart, by comparison, sold 17.3 percent of the country's groceries, while Kroger sold 8.9 percent, according to Bloomberg data.
Among those once skeptical of Amazon's move into groceries was Whole Foods co-founder John Mackey, who in 2015 was quoted as saying grocery delivery would be "Amazon's Waterloo."
"Food is the one thing Amazon hasn't been able to figure out," said Josh Olson, a technology analyst at Edward Jones. "They've tried out all these different concepts, and the question was always: Would going all-in mean getting into the bricks-and-mortar business?"
Analysts said Whole Foods stores could be useful in Amazon's quest to shorten shipping times. The hundreds of stores, clustered around urban areas, could essentially become holding grounds for Amazon products, according to James Bailey, a management professor at George Washington University.
"Now they can literally use the Whole Foods stores themselves as distribution centers," he said.
In Whole Foods, Amazon is acquiring a company that has recently come under pressure from investors for its lagging performance. The upscale merchant has found it difficult to attract more mainstream consumers as Walmart and other large chains have stepped up their sales of natural and organic products, and Whole Foods has posted six straight quarters of declining sales at comparable stores.
The U.S. grocery industry, once dominated by a handful of big chains, has been struggling to keep up with new competition. Nearly 20 grocers have filed for bankruptcy in the past three years, as regional chains such as Wegmans and Trader Joe's expand into new markets and delivery services such as FreshDirect gain popularity. The industry braced for a new threat Thursday, when German discount grocer Lidl opened its first 10 U.S. stores.
Under its deal with Amazon, Whole Foods, founded in 1980, would continue to operate under its existing brand. Mackey would remain chief executive after the purchase, and the company would keep its headquarters in Austin, Texas.
"This partnership presents an opportunity to maximize value for Whole Foods Market's shareholders, while at the same time extending our mission and bringing the highest quality, experience, convenience and innovation to our customers," Mackey said in a statement.
The deal is sure to put new pressure on Walmart, which has been aggressively expanding its online business in hopes of winning over consumers. The Bentonville, Arkansas-based retailer announced Friday that it had agreed to buy online clothier Bonobos for $310 million, adding to its roster of recently acquired Internet companies, including Jet.com (purchased for $3.3 billion), ModCloth, Moosejaw and ShoeBuy.com.
The Whole Foods deal is scheduled to close in the second half of 2017, pending shareholder and regulatory approvals. Although President Donald Trump has said that Amazon has a "huge antitrust problem," legal experts said the merger of the two companies is not likely to raise red flags.
"Generally speaking, there is very little overlap between Whole Foods and Amazon," said Michael Carrier, a Rutgers Law School professor who specializes in antitrust issues. "They're not really competitors. Add to that the fact that Whole Foods doesn't have the dominant positioning it did even a few years ago, and that makes it even more likely for this deal to go through."
The $42-a-share offer from Amazon is a 27 percent premium over Whole Foods Market's closing stock price Thursday.
Amazon, which is sitting on $21.5 billion in cash, has long eschewed big takeovers. Among the company's largest acquisitions are its 2009 purchase of online shoe retailer Zappos.com for roughly $1.2 billion and video game streaming site Twitch, which it bought in 2014 for about $1 billion.
"Whole Foods Market has been satisfying, delighting and nourishing customers for nearly four decades - they're doing an amazing job and we want that to continue," Bezos said in a statement.