The government cannot easily quickly ban the buying/selling of a certain thing like that. Just not how it works, far too slow moving.
Imagine if instead of putting out a press release, they had quietly banned selling masks by retailers and then 3 days later when people caught wind of it explained the shortage mean they were only for hospital workers.
All the anti government reactionaries that are now anti-maskers would be the most ardent mask wearers.