The federal government and most states are throwing away $28 billion in yearly tax revenue by not legalizing marijuana, according to a new analysis from the Tax Foundation, an independent think tank.

The bulk of that revenue -- $20.5 billion of it -- would accrue to states through the collection of excise taxes on marijuana sales, general sales taxes, and income and payroll taxes levied on workers and businesses in a mature legal marijuana industry.

The federal government would take in another $7.5 billion, primarily from income and payroll taxes, and $500 million in excise taxes if marijuana were to be taxed the same way tobacco is.

These are estimates relying on a certain number of assumptions about the size of the marijuana market ($45 billion in sales annually) and the ways that governments decide to tax the sale of the drug. For instance, if the federal government decided to slap a 10 percent surtax on marijuana sales rather than a tobacco-style per-pound tax, that $500 million excise tax figure would grow to $5.3 billion.

As German Lopez points out over at Vox, these figures account for just a tiny slice of annual government spending in the United States, so don't expect to balance your state budget on the backs of marijuana smokers any time soon.

Still, $28 billion is nothing to scoff at. The Tax Foundation analysis points out that marijuana tax revenues in Colorado and Washington are exceeding projections by a considerable margins. Colorado initially projected it would receive $70 million in annual taxes on marijuana sales and excise taxes, but it is on track to pull in $140 million this year. The money goes to fund things like school construction and drug abuse-prevention campaigns.

Critics point out that marijuana legalization carries some social costs too as people may become more likely to abuse the drug and suffer the negative consequences of abuse and addiction, if the drug is more widely available.

But as the Tax Foundation analysis points out, people are already using and abusing marijuana -- regardless of legality. According to the National Survey on Drug Use and Health, over 13 percent of Americans age 12 and older, 0r 35 million people, used marijuana in 2014. And 4.2 million of them met criteria for substance abuse or dependence.

We're already paying the social cost of marijuana abuse, in other words. Increased tax revenues could help offset those costs.

And marijuana prohibition carries a whole host of costs of its own -- roughly a half-billion dollars a year to arrest people for simple marijuana possession. Billions more to arrest and prosecute people who sell and traffic the drug. And the difficult-to-quantify cost of restricting the ability of millions of people who would prefer to use a drug that, by any reasonable metric, is considerably less harmful than alcohol.

More from Wonkblog: