Taxation in some of the cases you mention is win-win: alcohol, pot, etc. Vice taxes work because they add a financial disincentive to an objectively harmful activity (unless you're talking a glass of wine a day, a la Europe) to increase the short-term cost, effectively substituting for obviating the long-term cost.
In other words, we tax cigarettes now to deter you from smoking, but in the event that we can't do that, we use the increased revenues to pay for the increase in health costs that you rack up when you get lung cancer later. And yes, we pay for your lung cancer because you're likely on Medicare.
As to drugs, the idea of "legalize and tax" misses much of the point. That should be "legalize, regulate, and tax," where regulation is the process of telling you, the consumer, what you're getting, which in the case of drugs can minimize things like overdoses.
However, all that's arguably separate from issues like gambling which, while an addictive behavior, is not objectively harmful beyond the addiction. Most other vice taxes are regressive, but they serve a long-term benefit in disincentivizing the often-physically-unhealthy vice, whereas taxing gambling provides the disincentive to an activity that causes little objective harm. This makes gambling unique (at least so far as I can see) among the vices that we'd regulate in this manner.