Should people pay to opt-out of vaccination?

Herd immunity is a public good, but mandating vaccination could be seen as an infringement on liberties and autonomy.

On the object-level, I think a lot of people support the idea of mandatory vaccinations, but the meta-level principle 'the government should be able to force me to undergo medical procedures against my will' seems problematic.

Getting vaccinated incurs a small cost on most people (the time and effort and discomfort of getting a shot). But for some people it might be a greater cost if they have strong religious, medical, or other objections for example (whether these objections are based in fact is beside the point).

But not getting vaccinated incurs a cost on everyone else in the form of a negative externality. If you don't get vaccinated and I catch a virus from you, my medical bills and the opportunity cost of me missing work are literal costs you've imposed on me.

Could this be solved by requiring people to pay to opt-out of vaccination? For those who see vaccination as objectionable, presumably they would be willing to pay some amount to avoid it, and the money collected can go to covering the costs of those who got sick even though they were vaccinated.

For most people, the cost of opting out of vaccination would not be worth it, so lots of people would choose to get vaccinated without it being forced upon them. I wonder if this principle could also apply to face masks?