Amazon is making a big bet on physical stores and the business of food.

The online retail giant announced Friday that is buying organic grocery chain Whole Foods (WFM) for $13.7 billion in cash. The deal values Whole Foods at $42 a share, 27% higher than where the stock was trading Thursday.

Amazon (AMZN) said Whole Foods stores will continue operating under that name as a separate unit of the company. Whole Foods CEO John Mackey will stay on to lead Whole Foods, which will keep its headquarters in Austin, Texas.

The deal shows Amazon's interest in moving into the business of operating traditional brick-and-mortar stores, even as many retailers that have been crippled by Amazon's growth have announced a series of store closings.

It also shows Amazon's growing interest in groceries. The company has its own delivery service, AmazonFresh, and is experimenting with a "click and collect" model, letting customers buy groceries online, then pick them up in person.

The supermarket business, like many other parts of retail, has been hit hard by increased competition from Amazon itself, as well as Walmart (WMT).

Grocery giant Kroger (KR) said Thursday that its profits for the year would be lower than Wall Street expected, sending its stock plunging nearly 20%.

Then Kroger's stock plummeted 13% further on Friday after the Amazon-Whole Foods detail was announced.

Related: Grocery wars! Amazon and Walmart crush Kroger

Shares of other retailers with a big presence in groceries, such as Target (TGT), Costco (COST), SuperValu (SVU) and Sprouts (SFM), plunged as well.

And Walmart was down 5%, despite announcing another online commerce deal of its own Friday. It bought men's apparel company Bonobos.

But Amazon's stock rose 3% on the news. Investors don't seem too concerned by how much the company is spending. A warning of a possible credit downgrade by ratings agency S&P Global Ratings didn't hurt Amazon either.

S&P said that Amazon may need to take on more debt as a result of the acquisition. But Amazon finished the first quarter with $21.5 billion in cash and securities on its balance sheet -- and only $7.7 billion in long-term debt.

Amazon's deal for Whole Foods also further demonstrates the financial might of the Jeff Bezos-led company, whose market value is greater than that of the 12 largest traditional general retailers combined.

"Millions of people love Whole Foods Market because they offer the best natural and organic foods, and they make it fun to eat healthy," said Bezos.

Whole Foods, founded in 1978, is widely credited with helping to make organic food go mainstream. The company now has about 87,000 employees and more than 460 stores -- mostly in the U.S. But Whole Foods has also expanded to Canada and the U.K.

The company has been moving aggressively in big cities, targeting millennial shoppers with a store format called 365 by Whole Foods Market that, like rival Trader Joe's, has lower prices than the ones found at core Whole Foods stores.

Related: Supermarket stocks get clobbered after Amazon-Whole Foods deal

High prices, of course, have been a problem for Whole Foods. The company is often derisively referred to as Whole Paycheck since the company charges a pretty penny for spelt and quinoa.

The company was accused of overcharging customers by regulators in New York City in 2015 and that had a huge negative impact on Whole Foods. Sales plunged for several quarters.

And the company became the butt of jokes by late-night comedians. HBO's John Oliver did a savage skit about the company's high prices. (HBO, like CNNMoney, is owned by Time Warner.)

Oliver ran a mock commercial showing, among other things, a block of ice with an avocado balanced on top for $25.99, a pomegranate that listened to NPR for $64.99, and tilapia wearing yoga pants for $84.99.

Mackey eventually wound up apologizing to customers. But the damage was done.

Sales growth at Whole Foods has slowed and profits have yet to return to levels before the price scandal. That may be one reason why Whole Foods was willing to sell to Amazon.

It will be interesting to see if Amazon -- which has a reputation for keeping prices low -- will turn Whole Foods into more of a bargain retailer as well.

It's also worth noting that Whole Foods stock did not move much higher than $42 on Friday -- the price that Amazon agreed to pay. That could be a sign that Wall Street does not expect a bidding war for the company that would push the sale price higher.

So it looks like Bezos will inherit the bad PR baggage that comes with Whole Foods. I wonder if it's too soon for people to ask Alexa where they can find stalks of asparagus in a bottle of water for $6.