Buying legal marijuana in California could be pricey enough to keep the black market healthy.

Between customers, retailers and growers, taxes on cannabis may reach as high as 45% in parts of the state, according to a Fitch Ratings report. Those high taxes may keep consumers away from legal marijuana stores once the recreational retail market goes live on January 1.

"High effective tax rates on California cannabis may complicate the state's efforts to establish legal markets" said analysts Stephen Walsh and Karen Ribble in a Fitch Ratings report on California's marijuana taxes.

California marijuana consumers are going to have to pay a combination of state and local taxes that vary by municipality. Growers and sellers have their own taxes, too.

Consumers will pay a sales tax ranging from 22.25% to 24.25%, which includes the state excise tax of 15%, and additional state and local sales taxes ranging from 7.25% to 9.25%.

Local businesses will have to pay a tax ranging from 1% to 20% of gross receipts, or $1 to $50 per square foot of marijuana plants, according to the Fitch report.

In addition, farmers will be taxed $9.25 per ounce for flower, and $2.75 per ounce for leaves.

The Fitch report says this combination of state and local taxes for consumers, retailers and growers could keep portions of California's cannabis industry off the grid, where it has flourished for some time.

"California's black markets for cannabis were well established long before its voters legalized cannabis in November 2016 and are expected to dominate post-legalization production," said the Fitch report.

Among the eight states where recreational marijuana is legal, only Washington has a higher tax rate at about 50%.

Colorado and Nevada both follow with rates of 36%. Oregon has a tax rate of 20% and Alaska has a rate of up to 20%.

Medical marijuana has been legal in California since 1996, but the retail markets for recreational marijuana are just now ramping up and are scheduled to begin on New Year's Day.

Retail: Corona beer company is investing in Canadian cannabis

Black market farmers already face considerable obstacles to becoming compliant with state law, even without the taxes.

Van Bustic, a specialist in the environmental impact of cannabis cultivation for Berkeley's College of Natural Resources, said that registering with the state and becoming compliant will cost about $100,000. He said that many Humboldt farmers are unlikely to shoulder that cost if they can continue to operate in the dark.

The Fitch report says the black market could prove to be a "formidable competitor" to legal weed, if taxes push prices significantly higher than illegal, tax-free pot.

Other analysts agree that high taxes could actually be a boon to the black market.

"If taxes increase the price of cannabis beyond a certain point, the legal market becomes less competitive than the illicit market and then consumers become less likely to make the transition from the illicit market to the legal market," said John Kagia, analyst for New Frontier Data, which tracks the cannabis industry.

The Fitch report says this dynamic has already prompted Colorado, Washington and Oregon to lower their "initially uncompetitive" tax rates.

"It's almost certain that all of the states with recreational marijuana still struggle with the black market for marijuana because of its prevalence before legalization," said Morgan Scarboro, a policy analyst for the Tax Foundation's Center for State Tax Policy.

She said that high tax rates "will prevent the minimization of the black market" and that state governments "need to be open to evaluating their marijuana tax structures."

Related: Retail weed is spreading to California, Massachusetts, Maine

Colorado, Washington and Oregon have tried various tax structures, with mixed results, according to Kagia.

Oregon started in 2015 with a weight-based sales tax of $35 per ounce but changed that to a percentage sales tax of 20%.

Colorado got rid of a 2.9% sales tax but rose its excise tax from 10% to 15%, effectively raising its tax rate.

Washington started out with a 25% tax rate on producers and another 25% on processors, in addition to a 25% sales tax. Officials changed that to a 37% flat sales tax for cannabis that's in addition to standard state and local sales taxes.

"The only state that we know of that has undertaken a radical tax transformation is Washington," said Kagia, but he added that Washington still has the highest cannabis sales tax in the country.

Of the eight states where recreational marijuana is legal, three, including California, haven't yet started retail markets.

Massachusetts is expected to have a tax rate of 24% when it starts up its retail market in July of 2018, according to the Fitch report.

Maine has not yet established its tax rate.