Schools and mental health programs in Colorado will soon be getting their funding from the legal sale of marijuana, thanks to a newly passed law. On Friday, Governor John Hickenlooper signed off on the 2017-2018 Long Appropriations Bill, which established the state’s operating budget for the next year. The $28.7 billion budget includes newly allocated cash flows from the state’s Marijuana Tax Cash Fund (MTCF), made up of taxes collected on medical and retail sales of the drug. So far, nobody has objected to the fact that money from the sale of a controversial drug will be used to benefit kids and people with addiction problems.

It’s hard to argue with sums of the size the Centennial State is dealing with: Between 2016 and 2017, Colorado received a whopping $105 million from weed taxes. Thanks to the new budget, $9 million of the MTCF’s cash will go to the state’s Department of Education, which will be used to increase the number of health care professionals in secondary schools.

An additional $15.4 million from the MTCF will go toward providing housing assistance to homeless and at-risk people, $5.9 million will be used to help local law enforcement prosecute black market marijuana sellers, and $7.1 million is designated to end “the use of jails for holding people who are experiencing a mental health crisis, and to implement criminal justice diversion programs at the local level.”

In Colorado, the MTCF is used alongside another marijuana tax revenue fund — the Building Excellent Schools Today (BEST) fund — to funnel weed money back into the community. The state’s legislature created the MTCF in 2014, and in 2015 voters approved Proposition BB, which allowed the state to keep and spend the money from the tax revenue instead of refunding it to voters. Every fiscal year, the money within the MTCF is required to be spent on programs related to health care, health education, law enforcement, and substance abuse prevention and treatment programs. If the money is used for other purposes, there has to be a change in law.

This flow chart from the Colorado Department of Education explains how it works when it comes to schools:

How marijuana tax revenue is distributed.

Some people may find it problematic that money from marijuana, a substance whose legality and medical use is still debated among scientists and government officials, is being used to aid communities, but in fact it’s far from the first controversial substance to be taxed as a means to get cash into community-aiding programs. Whether it’s cigarette taxes in Missouri being used to fund early childhood education or liquor sales taxes going toward school lunch programs in Utah, taxed products are often used as a legislative bartering tool.

Before Maine legalized recreational marijuana in January, the potential to use marijuana tax dollars for substance abuse programs was used as a talking point for pro-legalization advocates. And while some Coloradans argue that marijuana tax dollars could be used more efficiently to help the state’s education system, there’s no doubt that millions flowing in is better than no cash flow at all.

Photos via Colorado Department of Education, Flickr