Medical marijuana has been known to help treat chronic pain and nausea but a new study suggests that pot also decreases the use of opiates and prescription painkillers.

If every state in the U.S. were to legalize the substance, Americans would save millions of dollars a year through the federal Medicare program, a review of spending in states that have approved the drug for medical purposes suggests. The total savings come out to $468 million a year, a jump from the $165 million saved in 2013 on prescription drugs in Washington D.C. and the 17 states where pot is legal.

“When  states   turned  on  medical   marijuana   laws , we did see a  rather substantial turn   away   from   FDA-approved  medicine,” W. David Bradford, a researcher from the University of Georgia and one of the authors of the report, said.

To come up with those figures, researchers looked at Medicare data from 2010 to 2013. They considered the use of drugs used to treat nine ailments, including pain, depression and nausea, all of which can be treated with weed. Of the nine, only one condition — glaucoma — did not see a decrease in prescriptions when medical marijuana was available for treatment.

“The results," Bradford said, "suggest people are really using marijuana  as medicine and not just using it for recreational purposes.”

Marijuana has grown into a giant industry in the states that have so far legalized the substance for recreational use and it has continued to grow. This April, the weed industry in states like Colorado and Washington posted record sales, with retail sales spiking more than 50 percent compared to the year before in Colorado and an almost 100 percent spike year over year in Washington State. Both legalized marijuana roughly four years ago.

As many as eight states could soon legalize recreational marijuana, joining the four state and the District of Columbia, where weed is already available to the general public.