After years of dipping its toes into the water of the massive market for groceries, Amazon (NASDAQ:AMZN) has jumped into the deep end by making a deal to buy Whole Foods Market (NASDAQ:WFM).

The news comes after the online retailer has publicly experimented with a variety of grocery formats. These include stand-alone stores with self-checkout, home delivery in varying speeds, and a number of convenience store models.

By buying Whole Foods for $13.7 billion, or $42 per share -- plus, assuming the company's debt -- Amazon gives itself a major platform to build from. Once the deal closes, Whole Foods CEO John Mackey will still run the company, reporting to Amazon CEO Jeff Bezos.

"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 in a press release. "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."

The grocery chain will keep its names and its headquarters in Austin, Texas. While the deal requires shareholder approval on the Whole Foods side, it is expected to close in the second half of 2017.

A Whole Foods Market

Amazon is buying Whole Foods. Image source: Whole Foods.

What does this mean?

Amazon clearly sees the grocery market, which topped $600 billion in the U.S. in 2015, as a potential source of growth. The company is not alone in those ambitions as European chains Aldi and Lidl have also been targeting the United States for growth. Both chains offer a smaller version of the traditional supermarket with smaller stores, lower prices, and more house brands.

That's a direction Whole Foods has been increasingly moving to. The chain still offers upscale items, but in recent quarters it has stepped up its 365 brand, even launching lower-frills stores under that moniker, which feature lower prices and more house brands.

Under Amazon Whole Foods will serve a number of purposes. Its locations can serve as delivery hubs for the company and its stores can stock merchandise that the online retailer's data shows will sell in that particular market. In addition Whole Foods stores can, where appropriate, be updated with some of the technology Amazon has been testing in its own concept stores.

It's a crowded space

While Whole Foods has struggled in recent quarters amid increased competition it remains a premium brand with a devoted fan base. That audience likely overlaps with Amazon's audience and the two brands feel, at least at first glance, like a natural match.

This is a smart purchase that can benefit both brands. Amazon can enter groceries without having to build from scratch and it gets to take over a strong position in a very crowded field. Exactly how this plays out will be a work in progress, but it should make Amazon stronger while giving consumers a better, technology-driven Whole Foods.

John Mackey, CEO of Whole Foods Market, is a member of The Motley Fool’s board of directors. Daniel Kline has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Amazon and Whole Foods Market. The Motley Fool has a disclosure policy.