For a moment there, Jeff Bezos was the richest man in the world. But then (AMZN -2.56%) reported earnings, and Bezos had to hand the crown back to Bill Gates. Shares are down today after the company's bottom line missed analyst expectations by a mile. Total revenue in the second quarter jumped 25% to $38 billion, but net income fell by nearly 80% to $197 million, or $0.40 per share, as the company aggressively reinvested in the business (as usual).

Analysts had been expecting the company to report $37.2 billion in sales and $1.41 per share in profits, a full $1 per share higher.

Stylized visualization of a data center

Image source: Getty Images.

Amazon Web Services also missed

The company's cloud infrastructure business, Amazon Web Services (AWS), also fell short of expectations. AWS brought in $4.1 billion in revenue, enough to generate $916 million in operating income (good for a 22% operating margin), but the Street was hoping for closer to $1 billion in AWS operating profits. For years, the much more profitable and rapidly growing business has been helping stabilize Amazon's consolidated results as the company reinvests in expanding core e-commerce operations around the world.

Those reinvestments aren't limited to e-commerce, either. Amazon continues to build up AWS infrastructure, which caused some modest margin contraction even as sales increased sequentially to the highest level ever. CFO Brian Olsavsky noted that AWS gross margin expanded by 130 basis points, so investments are what's taking a toll on operating margin.

A lot of this is coming in the form of capital leases, according to Olsavsky:

I'll also point out that the strong usage growth at AWS has led us to a step up in infrastructure in the form of capital leases. We've built capital leases in the trailing 12 months. They've increased 71% through the end of Q2 versus last year. That is servicing -- accelerating usage in our largest AWS services as well as geographic expansion. So that's additional factor sequentially in the quarter year-over-year.

Property and equipment acquired under capital leases jumped 92% to $2.7 billion during the quarter. Unlike an operating lease, where the leased asset is not accounted for on the lessee's balance sheet, a capital lease is effectively a purchase, so the underlying assets do get recorded on the lessee's balance sheet.

When asked again about AWS margin contraction, Olsavsky replied:

Those margins, as we say frequently, are going to fluctuate quarter-to-quarter and always going to be a net of investments, price reductions and cost efficiencies that we drive. So I would say the biggest impact in the margin that you're seeing in Q2 is really around the 71% increase in assets acquired under capital leases. Most of that is for the AWS business. So we've really stepped up the infrastructure to match the large usage growth and also the geographic expansion, and that is showing up in tech and content. On the marketing, if you look under the marketing expenses, they are also up and that is driven by the increases we're seeing in the sales team, both in AWS and advertising. So I would point to those two as probably larger-than-normal impacts on Q2 operating margin.

Alphabet subsidiary Google continues to push higher in the cloud with its Google Cloud platform, thanks in part to scoring one of the biggest cloud customers out there, Snap. (AWS is a secondary provider for Snap.) Microsoft's commercial cloud annualized run rate is now over $15 billion as the software giant also steps up the competition. But AWS remains the market leader, and Amazon intends to keep it that way by investing heavily in the cloud.