Shares of memory-chip maker Micron Technology (NASDAQ:MU) soared nearly 90% in 2017, the result of rising prices and surging demand for its products. Micron's profits soared along with the stock. In the latest quarter, Micron managed an operating margin of 45.5%, up from just 9% in the prior-year period. Over the past 12 months, the company produced net income of $7.6 billion.

Based on that number, Micron's price-to-earnings ratio currently sits at just about 7. The forward ratio, based on the average analyst estimate for fiscal 2018, is a lowly 4.5. The S&P 500, for comparison, trades for 26 times trailing-12-month earnings. Certainly, Micron looks cheap.

I'm here to tell you that the stock isn't nearly as cheap as it appears. Here's why.

We're nearing the peak

DRAM and NAND chips are commodities, so pricing is largely determined by supply and demand. When demand outstrips supply, as it did in 2017, Micron enjoys a period of exceptional profitability. When the tables turn and supply outpaces demand, as it did in much of 2016, Micron often posts a loss.

Here's how volatile Micron's net income has been over the past decade:

Micron trades for a single-digit multiple of peak earnings. If you average its net income over the past 10 years and use that number, the P/E ratio jumps to 57. Even averaging over the past five years, when Micron was profitable in all but one year, the P/E ratio is nearly 23.

Micron's currently incredible margins aren't sustainable. Valuing the company based on those margins is a mistake.

Other ratios tell a different story

Because Micron's P/E ratio isn't very useful for valuing the company, it's a good idea to take a look at two other ratios to put the stock price in perspective. The first is price-to-sales, and the second is price-to-book value. If Micron was truly cheap, you'd expect both of these ratios to be on the low-end of their historical ranges.

That's not the case at all.

Here's Micron's price-to-sales ratio over time:

And here's its price-to-tangible book value ratio, which ignores intangible assets on the balance sheet:

Both ratios are a long way from historical lows. The stock isn't as expensive as it was the last time Micron's profits boomed, but I don't think you can call the stock cheap looking at these charts. Could the stock go higher from here? Certainly. But it's no bargain.

Strong demand is not enough

Micron CEO Sanjay Mehrotra talked a lot about demand in the latest earnings . From cloud data centers to autonomous cars, there's little question that the number of bits sold is going to continue to trend upward in the coming years. But that doesn't imply that Micron's financial results will do the same.

That's because demand is only half of the equation. The other half is supply. Demand can be extremely strong, but if supply grows faster and pushes down prices, Micron isn't going to make any money. Here's something to think about: The smartphone market grew from essentially nothing 10 years ago to around 1.5 billion units annually today, creating a massive new source of demand for memory chips. Even so, Micron lost money in four of the past 10 years, including as recently as 2016. Strong demand does not automatically equal profits for Micron.

Micron stock is nowhere near as cheap as it looks. That doesn't mean it can't be a solid investment from here, especially if this period of elevated prices for memory chips persists for a while longer. But it's not the clear-cut bargain that the P/E ratio suggests.