Micron Technology (MU 2.55%) is coming off a terrible quarter. The company's revenue and earnings fell significantly thanks to the declining prices of memory chips stemming from an oversupply in the industry.

The company's guidance indicates that things are about to get worse because memory prices are expected to fall further, which could eat into the chipmaker's massive pile of cash. That's the reason why Micron has decided to lower its capital spending by over 30% in the new fiscal year. But shortly after, the company announced a massive investment of up to $100 billion in central New York.

The chipmaker plans to spend this money over a 20-year period to construct a massive fabrication plant. Micron says that the first phase of this investment -- worth $20 billion -- could be completed by 2030. Construction of the site is expected to begin in 2024 and production from the new plant should start ramping up in the second half of the decade.

Investors, however, may be wondering why Micron made such an announcement at a time when the weak demand for memory chips and oversupply has crushed prices and wrecked the company's top and bottom lines. We'll have to look at the memory market's long-term prospects to find the answer to that question.

Micron Technology is playing the long game

The decline in sales of personal computers and smartphones has weighed heavily on the memory market this year. This was evident from Micron's fiscal 2022 fourth-quarter results (for the three months that ended on Sept. 1, 2022). The company's revenue fell 20% year over year to $6.6 billion, while adjusted operating income as a percentage of sales was down to 25% from 37.1% in the year-ago period.

Micron's forecast for an adjusted gross margin of 26% in the current quarter points toward more pain, as it would be a massive decline from the prior-year period's non-GAAP gross margin of 47%. Things are unlikely to improve in 2023 because the oversupply conditions in the memory market are expected to persist next year due to tepid demand growth.

Still, Micron management seems focused on the bigger picture in the memory market. From the growing deployment of dynamic random access memory in smartphones to an increase in memory content in vehicles to a jump in artificial intelligence (AI) and machine learning (ML) workloads in data centers, there are several reasons why memory demand is expected to shoot higher in the long run.

At its 2022 investor day, Micron pointed out that the amount of dynamic random access memory (DRAM) shipped in data centers will double by 2025 compared to last year. NAND flash storage, meanwhile, is expected to triple over the same period. Even better, Micron anticipates the data center memory market (including both DRAM and NAND flash) to sustain its impressive momentum through 2030, generating close to $180 billion in revenue versus around $60 billion last year.

Meanwhile, nascent markets such as high-bandwidth memory are also expected to take off, generating $13 billion in revenue by 2030 compared to $1 billion last year. On the other hand, Micron anticipates an increase of 30 times in DRAM content and a 100x increase in NAND flash content in vehicles as the level of autonomous driving adoption increases. This explains why the market for automotive memory is expected to generate $17.2 billion in annual revenue in 2028 versus $3.5 billion last year.

As such, it is not surprising to see why Micron is setting itself up for long-term success with an aggressive investment plan that could help it thrive in the long run.

Investors need to be patient

Micron's $100 billion investment is going to be spread out over a long period, so the company won't be reaping any immediate benefits. On top of that, the stock is likely to remain under pressure in the near term thanks to the persistent weakness in the memory market. That's why buying Micron Technology shares may not look like a good idea right now, even though they are trading at just seven times trailing earnings.

The forward earnings multiple of 13 shows that the company's earnings are set to decline this fiscal year versus its fiscal 2022 earnings of $8.35 per share. However, things are expected to improve from fiscal 2024.

MU EPS Estimates for Current Fiscal Year Chart

MU EPS Estimates for Current Fiscal Year data by YCharts

And as the long-term outlook indicates, Micron could clock an impressive pace of growth beyond the next couple of years as well thanks to the secular growth in the memory market. All this tells us why investors should look for signs of a turnaround in Micron's fortunes and start buying this semiconductor stock once the memory market begins recovering.