This is a common problem in many domains. For example, there's massive new demand of Airbus planes after the Boeing 737 Max 8 disaster, and their manufacturing capacity is maxed out.
I'm familiar with it from the domain of software development, so I'll use that as an example.
Suppose some website gets mentioned on Reddit and the post happens to hit the first page. It gets the "Reddit hug of death" (the swarm of reddit users overwhelm the website's servers, and it becomes unavailable). You could ask the same question:
How is it possible that the producers of [this site] give up on additional earning by not [spinning up more servers], now that it's pretty obvious the demand is going up?
If that "additional earning" (of having more of your product available to provide) is less than it costs to permanently over-provision a resource (web servers, mask production factories, etc.), then it's not economical to do so.
Cloud infrastructure is becoming incredibly liquid, because resources are very flexible and can be pooled. A high traffic day for my website might be a low traffic day for yours. A cloud provider could scale down your site (saving you money) by uninstalling your software from a server, reassigning that server to me, and use it to scale up my site by installing my software on it (raising my infrastructure costs, but also raising my business' income because it hasn't gone down). There are even auto-scaling systems that can scale your service up and down in response to current load. There's still some lead time, on the order of a few minutes for web server virtual machines.
The real world is much less flexible than software. If masks are in hot demand, but construction helmets aren't, you can't re-purpose the injection molds for hard hats into face-mask stitching machines. There are many factors involved in deciding whether or not its worth in investing to grow the mask manufacturing business:
- How many masks are available in reserve? In the warehouses of factories and distributors, in hospitals, in military bases, etc.
- How long do we think this epidemic will last? Will it last long enough to deplete the reserves? Is it long-term enough to justify the high up front expenses?
- How much marginal profit is there to be made in selling these extra masks?
Interestingly, this problem repeats itself and plays itself out upstream in the supply chain. Are the companies that make mask-stitching machines able to produce enough for the new demand? What about their upstream supply chain?