Quarterly profit at Amazon.com fell by 77% even though its sales surged, a sign of how high the costs are of its increased dominance across the retail sector.

The retailer, based in Seattle, earned its smallest profit for a quarter in close to two years. The e-commerce giant posted a profit of $197 million on sales of $38 billion for the second quarter as it increased its cost for new warehouses and delivery investments for its data centers in its cloud services and retail business.

Amazon also spent large amounts of its funds on hiring engineers for its Alexa artificial intelligence service and new warehouse workers.

Amazon’s sales grew 25% at traditional retailers’ expense. Traditional retailers continue to struggle with dropping foot traffic throughout malls and the shift by consumers to spend much more online.

During a time when Amazon has been investing large amounts of funds and expanding, other retailers have been hit with high amounts of debt and dropping sales, that has forced them to cuts jobs and shutter stores, which has helped to extend the advantage Amazon has.

Amazon’s share price was 2.3% lower in trading after hours as it missed on its profit as well as guidance expectations, a tempered reaction given other retail stocks have dropped by double digits.

Amazon shares, which ended the day on Thursday at a price of $1,046, were approximately 39% higher from the same date one year ago.

The high expectations for the company temporarily placed its CEO and founder Jeff Bezos atop the list of the richest people in the world on Thursday, as Amazon stock touched a new record high in early trading prior to the quarterly results being released.

Bezos pushed past longtime No. 1 Bill Gates of Microsoft, before slipping back to No. 2 when Amazon’s stock closed lower.

Amazon is making a huge push into physical brick and mortar locations, which many expect will hurt its traditional retail competition even more.

In June, Amazon acquired Whole Foods Market for $13.7 billion, which included debt. That immediately put the company in as a major player in brick and mortar grocery and retail.

On Wednesday, Whole Foods posted comparable sales that dropped again for its most recent quarter. That is a trend it promised would be reversed before September.

The shift to shopping online from in-store has left numerous strong brands unable to continue ignoring Amazon’s strength.

Get Analysts' Upgrades and Downgrades Daily - Enter your email address below to receive a concise daily summary of analysts' upgrades, downgrades and new coverage with MarketBeat.com's FREE daily email newsletter.