It works once, but the next pandemic may happen without any vaccines.
The consensual, win-win way is to buy vaccines from the manufacturers, at high prices. This makes manufacturers wealthy by making people healthy and aligns incentives for the common good.