The government could make a lot of money by legalizing marijuana. But it's probably not as much money as you think.

That conclusion is based on a new report by the Tax Foundation. The analysis found that each year a "mature marijuana industry could generate up to $28 billion in tax revenues for federal, state, and local governments, including $7 billion in federal revenue: $5.5 billion from business taxes and $1.5 billion from income and payroll taxes."

What if the federal government imposed extra taxes on marijuana sales? The Tax Foundation found, "A federal tax of $23 per pound of product, similar to the federal tax on tobacco, could generate $500 million per year. Alternatively, a 10 percent sales surtax could generate $5.3 billion per year, with higher tax rates collecting proportionately more."

So up to $12.3 billion in annual federal revenue, based on the Tax Foundation's analysis. That's not bad. But it would only cover a very tiny portion — less than 1 percent — of federal spending, which was estimated at $3.8 trillion in fiscal year 2015.

Similarly, the $28 billion in local, state, and federal tax revenue would cover less than 1 percent of $6.4 trillion in all government spending, including local and state spending, in fiscal year 2015.

The Tax Foundation also suggests that tax revenue will fall as more businesses get into the marijuana industry and "drive down profit margins." That would be partially made up by an increase in pot workers' individual income and payroll taxes, which the Tax Foundation says "are expected to increase as production expands."

But ultimately, the group estimates that tax revenues will fall from $28 billion to $22 billion over time, as long as "all states implement a 25 percent sales surtax and the federal government has an excise tax similar to that of cigarette[s]."

The tax revenue comes in addition to the other gains from legalization

The analysis is making some assumptions — it's unclear how cities, states, and the federal government would tax marijuana and whether all jurisdictions really will legalize. But the study still gives a rough approximation of how much tax revenue marijuana legalization could raise — and it's just not going to fill big budget holes.

The Tax Foundation doesn't, however, estimate how much money would be saved from no longer having to enforce current marijuana laws. A 2013 report from the American Civil Liberties Union estimated marijuana prohibition costs $3.6 billion in enforcement each year. But a regulatory system for the pot industry costs some money to operate, too, so it's likely that some of this $3.6 billion would go back to new spending. Still, it doesn't add much to the overall figures either way.

Any tax revenue is, of course, still great! And it comes in addition to the other gains from legalization: fewer racially disparate arrests and a smaller black market for drugs that criminals can use to fund their violent operations.

So don't expect marijuana to totally solve your state's budget crisis anytime soon. But when looking at all the benefits combined — less racism in the justice system, reduced drug-related violence, and a few billion dollars on the side — legalization starts looking a lot stronger.