But Mr. Freedman says the biggest drag on revenue is that so much of Colorado’s marijuana market remains unregulated. A 2014 report commissioned by the state’s Department of Revenue estimated 130 metric tons of marijuana was consumed in the state that year, while just 77 metric tons was sold through medical dispensaries and recreational marijuana retailers. The rest was untaxed: a combination of home growing, production by untaxed medical “caregivers” whose lightly regulated status is protected in the state constitution and plain old black-market production and trafficking.

The state is trying to get its marijuana market in order. It has imposed new rules to limit the number of plants that caregivers may possess, aiming to ensure their operations are truly aimed at providing for a small number of patients, not diverting some of the supply into the recreational market. And it is tightening oversight of doctors to ensure medical marijuana recommendations are written only for bona fide debilitating medical conditions. In time, these moves may draw more users into the recreational market where they belong.

On the other hand, falling market prices could cut into future tax revenues. Retail prices in Colorado were generally more than $10 a gram as of last fall. In some cases, that was more than marijuana in the illegal market. But illegal production is costly and inefficient. As legal producers scale up and compete, they are likely to cut prices sharply, according to Mark Kleiman, a drug policy expert at the University of California, Los Angeles, who has played a major role in establishing Washington State’s legal marijuana market. According to Samantha Chin, the director of marketing at Colorado Pot Guide, retail prices have fallen between 16 and 30 percent in the Denver area since November.

“If commercial cannabis is $2 per gram at retail, I doubt people will bother getting a medical card,” Mr. Kleiman says. Because the state’s marijuana tax is levied per dollar, not per gram, a sharp drop in prices would mean even less tax revenue.

There are lessons here for other states. Because of low public support for marijuana prohibition, many jurisdictions have intentionally lax enforcement around illegal marijuana markets. This often shows up as a wink-wink culture around medical access. (See, for example, “Medical Kush Doctor” signs that once adorned storefronts in Venice, Calif.) After legalization, that culture of lax enforcement can be a barrier to tax collection.

Another lesson is that marijuana taxes should be “specific excise” taxes per unit of intoxicant. In most states, cigarettes are taxed by the pack and alcohol by the liter. Marijuana could similarly be taxed by the gram (either of plant or of T.H.C.), which would protect states from revenue declines if pretax prices fall.