City governments are attempting to discourage medical marijuana dispensaries — and potentially retail outlets, too, should a legalization measure pass in November — by imposing taxes on both medical and recreational pot sales.

So far, medical dispensaries are opening anyway, and taxing retail outlets ahead of time could result in unintended consequences. In any case, ordinances should be designed to tax medical marijuana at a lesser rate, if at all, out of consideration for seriously ill patients who rely on the drug.

The Ashland City Council did the right thing Tuesday night, voting not to tax medical marijuana at all, while enacting a 10 percent on recreational marijuana should the legalization measure pass. One dispensary has reopened in that city, and two have obtained provisional licenses from the state.

Central Point enacted a 10-percent tax, but set the rate at 5 percent for holders of medical marijuana cards. The city has no plans to lift a moratorium on dispensaries before it expires next May.

In Gold Hill, where the City Council's decision to allow a single dispensary to open ignited a recall attempt against four council members, that city's 5 percent tax yielded $1,800 in revenue for the town in the first three weeks the dispensary operated.

So-called "sin taxes" are a time-honored way for governments to raise money while discouraging an activity that some members of the public disapprove of. Liquor taxes are a prime example. This puts the government in the contradictory position of relying on income from an activity it supposedly wants to limit.

That approach to the potential legalization of recreational marijuana is understandable. It is less so in the case of medical marijuana. Society is grappling with the regulation of a substance that has medical uses but is also a popular recreational drug. If it is medicine, it makes little sense to tax it, except to take advantage of patients who need a safe, reliable supply. Even states with general sales taxes usually exempt prescription medications.

Cities that choose to tax recreational pot are betting that will grandfather them in and let them get around language in the legalization measure that bans local taxes. That will likely be a decision for the courts, but it's hardly a sure thing.

What's more, taxing recreational pot too heavily could backfire. Washington state, where voters legalized marijuana, is discovering that strict regulations and high taxes have resulted in retail pot prices outstripping black market street rates.

If one of the arguments for legalization is to eliminate the black market, that's not a very good way to go about it.

Finally, it's at least a bit ironic that while some city leaders have expressed concern about granting business licenses to stores that sell a product in violation of federal law, they seem to have no problem cashing in on that same product's sales.