Amazon will do whatever it takes to extract the market share Walmart has in the grocery business, even if it includes slashing prices at its Whole Foods stores, CNBC's Jim Cramer said Tuesday.

Cramer, the host of "Mad Money," said his sources at Amazon indicate to him that "whatever Walmart is doing" on prices, Jeff Bezos' e-commerce giant "will come under" it.

"They hate, hate, hate Walmart. Walmart is the biggest grocery chain in the country," Cramer said on "Squawk on the Street." "Amazon will stop at nothing to take away the share that Walmart has gained."

Cramer's charitable trust owns shares of Amazon. Amazon did not immediately respond to CNBC's request for comment on Cramer's remarks.

Amazon said it will slash prices on hundreds of items at Whole Foods stores starting Wednesday as the company extends its focus beyond enticing Prime shoppers. Amazon acquired Whole Foods, known for its organic selection and high prices, in 2017. Amazon had hoped to convert more Prime members into Whole Foods shoppers.

"I've been waiting for this," Cramer said in response to Amazon slashing prices.

When Amazon first announced its deal to buy Whole Foods in June 2017, Cramer said the purchase would be a "game changer" for the entire food industry.

The deal at the time was also seen as a blow to Walmart, which had been struggling to compete in online shopping and was using its vast footprint of stores to help distribute products. Prior, Amazon's stake in the grocery business involved its Fresh delivery subscription service.

Amazon, which has a market cap of more than $891 billion, has seen its shares rise 32 percent over the last 12 months. The stock has risen 20.59 percent since the beginning of the year.