The history of grocery stores — from the A&P to Amazon’s surprise purchase of Whole Foods — can be traced back to a common kitchen product: Baking powder. Really.

Back in the late 1800s, the proprietors of the Great Atlantic & Pacific Tea Company faced a problem. The tea industry they had controlled for decades had become widely available. Prices fell. It appeared Great Atlantic & Pacific would too.

The Hartford family, the owners of the company, decided to diversify. They added a controversial product: baking powder. Housewives loved the stuff, which made bread rise faster. Baking powder became so popular that unscrupulous producers, in rushing the product to stores, weren’t exactly delivering the real deal. Also, the prices were high.

Listen to this story on “Retropod”:

For more forgotten stories from history, listen online or subscribe: Apple Podcasts | Google Podcasts | Stitcher | More options

The Hartfords decided to make their own baking powder. They even hired a chemist. And then they packaged the powder in red tins, labeling it A&P — leveraging the company name to denote quality.

“A&P Baking Powder was an important product in the history of retailing,” Marc Levinson wrote in “The Great A&P,” a  history of the company and grocery stores. “With it, the Great Atlantic & Pacific Tea Company, and many of its competitors, began a transition from being tea merchants to being grocers. It was a transition that would dramatically change Americans’ daily lives.”

The branding of baking powder was important because most merchants back then were just essentially selling, as Levinson wrote, “generic products indistinguishable from what was for sale down the street.” And in selling their powder in a tin, the owners were ahead in another important way — packaging.

The invention of the cardboard box changed everything.

The company could now make, brand and sell its own condensed milk, butter, spices — just about any staple of the kitchen.

“By the early 1890s,” Levinson wrote, “Great Atlantic & Pacific was making the shift from tea company to grocery chain.”

Its name: A&P.

There was difficult, transformative work ahead. The company needed to upend an entire culture of shopping built around neighborhood stores, a history detailed in a fascinating 2015 paper titled, “The Evolution of the Supermarket Industry: From A&P to Walmart,” by Paul B. Ellickson:

Before 1900, American shoppers purchased their groceries through a wide array of specialty shops and general stores. Meat was purchased from a butcher, fish from a fishmonger, bread from a baker, and produce from a vegetable stand. Mostly sole proprietorships, these stores were often run in a haphazard manner with little use of modern accounting practices or scientific management principles. There were certainly many stores, likely well over half a million, although accurate historical statistics do not exist for this period. Because most people arrived on foot, grocers needed to be close to their customers, so the stores were small and ubiquitous. They often delivered what was purchased and sold many goods on credit. The small sales volume of these tiny shops led to high costs and sizable markups.

A&P built big stores, stocking as many products as possible, many made in their own warehouses. Products were stored in shelves, not behind a counter for an employee to distribute. No credit — cash. Manufacturers liked the model, selling products directly to the company, not through wholesalers. This kept product costs down for A&P, which passed those savings on to shoppers.

The company become obsessed with prices. In the early 1900s, its profit was 3 percent of revenue. This was too high. A new profit goal was set: 2.5 percent.

“If the company’s profit margin widened,” Levinson wrote, “it would be not a good sign but a bad one, an indication that A&P was forsaking the cost discipline that would lead it to domination of the grocery market.”

A&P’s business model began to sound a lot like the one pursued by its retail descendants — Walmart and Amazon — though it would later fall prey to mismanagement and two bankruptcies that shuttered hundreds of stores.

“Their basic strategy was so extraordinarily simple it could be captured in a single word: volume,” Levinson wrote. “If the company kept its costs down and its prices low, more shoppers would come through its doors, producing more profit than if it kept prices high.”

Amazon’s tea was books. Then it diversified. On Friday, Amazon disrupted yet another sector of retailing with its $13.7 billion deal for Whole Foods — linking the Internet retailer to the baking powder purveyor that started it all.

Read more Retropolis: