One of the main responses to yesterday's post on preparing for a potential quarantine was something like:
Hoarding causes shortages. Leave masks for people that need them.Another commenter made a similar argument with food.
I think the biggest question here is whether you think there's time and capacity for producers to react to increased demand. For example, some mask factories are not running right now because they're in affected areas, but many others are still running. More people trying to buy masks raises the market price, which makes it worth it for these factories to run at higher output. For example, maybe a factory normally runs a 16hr day with two shifts but doesn't run at night because it's too expensive to hire people for night work. If masks are selling for 5x the normal price, the situation is different and they'll probably start running 24hr. 
This is a really big reason to prepare ahead of time, instead of when a disaster seems likely. I bought masks months ago after deciding they were something I would like to have on hand for dealing with a range of issues, which meant producers had plenty of time to react and make more. I know this doesn't help with the current situation, but if there are non-perishable things where a supply disruption would be really bad (ex: masks for taking care of an immunocompromised family member) set a reminder for six months from now to stock up on them.
I also don't think spreading the idea that one shouldn't buy masks is worth it: enough people are still going to be buying them that we're still going to have a mixture of outages at regular retailers and high prices at demand-responsive online ones. Even if you think that there's no ability for producers to react to high prices by creating more masks and so there's effectively a fixed pool of masks to divide up, refraining from buying ones for yourself helps others only minimally.
(Separately, there's a question of what situations masks are useful for. I know much less about this, though if someone in your household gets sick it seems like it would be very useful to have them on hand.)
 Raising prices in response to emergency-induced demand is often called "price gouging" and it is sometimes illegal, though in long-running emergencies like this I wouldn't expect to see the laws apply because documenting increased costs should be practical.