Shares of memory giant Micron Technology (MU 0.26%) rallied 30.5% in June, according to data from S&P Global Market Intelligence.

Micron reported earnings late in the month that handily outpaced analyst expectations. Even though the stock fell in the aftermath, there had already been a huge run-up into the earnings report, reflecting a pre-earnings surge in memory pricing.

Micron handily beats, as expected

In its fiscal third quarter, Micron saw revenue grow 36.6% year over year to $9.3 billion, with adjusted non-GAAP (generally accepted accounting principles) earnings per share more than tripling to $1.91, each well ahead of analyst expectations. In addition, Micron forecast an above-consensus $10.7 billion in revenue for the next quarter, along with $2.50 in adjusted EPS, amounting to quarter-over-quarter growth rates of 15% and 31%, respectively.

The stellar results have come about due to artificial intelligence (AI), which is no surprise. Micron reported a near-50% quarterly increase in its high-bandwidth memory (HBM) used in AI training. Micron got a bit of a late start on HBM, but is rapidly catching up to market leader SK Hynix, while Samsung, the leader in traditional DRAM memory, struggles with its HBM technology.

Micron management reiterated it was on track to achieve the same overall market share in HBM, as its current overall DRAM share by the second half of the year, and that it had now qualified its HBM solutions with four customers across AI GPUs and ASICs.

Investors had expected good news, especially as older-generation DDR4 prices skyrocketed over the last couple of months, while HBM prices remain fixed and profitable based on prenegotiated contracts. The DDR4 price spike won't last, however, because it's due to Micron and other memory players "end of life-ing" those DDR4 products for newer DDR5. Still, the long-term outlook for DRAM memory appears positive, given the massive demand coming from artificial intelligence systems.

Magnifying glass with the words AI superimposed on a human head.

Image source: Getty Images.

Micron looks expensive, but it may be justified

Micron now trades at 22 times earnings, but since the company has been so cyclical in the past, it has usually been better to value Micron based on book value. With the stock now at 2.75 times book value, that's at the high end of its historical range.

MU Price to Book Value Chart

MU Price to Book Value data by YCharts

That said, things are arguably looking better for Micron than ever before in the age of AI. HBM pricing is more stable than traditional memory and is in perpetual short supply, given that HBM is a primary bottleneck for AI systems today. Furthermore, Micron has surged ahead of its two main rivals in process technology, with management noting "excellent progress" on its upcoming 1-gamma node.

So while Micron's shares may look fully valued, the stock may re-rate higher if it can sustain multiple years of better profitability and less cyclicality.