Online selling giant Amazon is buying high-end grocery store chain Whole Foods in a deal that has the potential to revolutionize both sides of the retail industry.

Amazon will pay $42 US a share or $13.7 billion in cash for Whole Foods' shares, a 27 per cent premium to what Whole Foods was worth on Thursday.

Amazon's own shares gained $23.54 US in reaction to the news on Friday to close at $987.71 US on Nasdaq.

Whole Foods shares closed at $42.68 US on Friday — just above the offer price, which suggests some investors think a better offer from someone else could be coming. The grocer must pay a $400 million US break fee if the deal falls apart.

Amazon plans to leave Whole Foods' network of stores pretty much as they are, retaining all employees, locations and the current executive team. Whole Foods has 431 stores in the U.S., a handful in the U.K. and 13 more in Canada — mainly in Toronto and Vancouver, but also one location in Victoria, and one in Ottawa.

While Amazon is best known as an online selling colossus, in recent years it has dabbled in conventional retailing, opening a few bricks-and-mortar book stores in 2015 followed by a small number of cashless grocery stores last year.

But Friday's news is by far Amazon's biggest step into conventional retail — and its biggest acquisition of any type of company in dollar terms.

"The line has now been crossed as Amazon has started its invasion of bricks and mortar with the beachhead food category," retail analyst Bruce Winder of the Retail Advisors Network said. "The retail war has been elevated to a new level now as Amazon dukes it out from both a cyber and bricks format."

Doug Stephens, the founder of RetailProphet, says the move has the potential to change the way grocery stores operate, and also how Amazon does.

Most grocery stores operate on a razor thin profit margin, so don't have a lot of cash on hand to invest in new technology or innovation. Amazon, on the other hand, spends much of its money doing just that. So having a technology powerhouse coming in to shake up the way people buy food "is a really daunting prospect for the grocery industry," Stephens told CBC News in an interview.

The company recently rolled out a few locations of something called Amazon Go, which is essentially a small grocery store with no cashiers.

Instead of lining up to pay at the end, customers simply log in via an app when they enter the stores, collect whatever they want from the aisles, and go home — the bill is sent to their account, based on GPS technology that monitors and tracks what they picked up and purchased.

"That's a pretty compelling proposition," Stephens said.

The move could also shake up the way Amazon does business outside grocery stores, by giving the chain a network of hundreds of distribution hubs for its other products.

One of Amazon's biggest costs right now is "last-mile delivery," Stephens says, which is the cost that Amazon pays to deliver bought items to its customers' front doors.

But buying Whole Foods and its network of stores gives them "an immediate distribution network of hubs across North America where orders can be shipped to, and customers can pick them up."

That saves Amazon a lot of money it's currently paying to delivery services and couriers, but it also gives Amazon the chance to put their other products — such as smartphones, tablets and smart speakers — in every Whole Foods store, to reach customers who don't normally shop with them multiple times a week.

"This all feeds into the larger ecosystem of all the other things that Amazon sells," Stephens said.