It’s easy to grasp the economics of the situation. It’s the logic behind it that sets the mind spinning.

The stories about the cost of medicinal marijuana, which soon can be sold to people with prescriptions at eight dispensaries across the state, contain more turns than a lighthouse staircase.

It’s far more than a little odd to read that the price of a legal substance has to be set at or above the price of its illegal counterpart in order to keep the people who buy it legally from making an under-the-table profit by illegally selling it for less than the full illegal price.

It’s as though Milton Friedman and John Maynard Keynes came up with a new law of economics while grooving over a lava lamp and indulging in the munchies. It may not be Nobel Prize-winning thought, but it seems unique in the annals of commerce.

So, the dispensaries are planning to price their pot at $300 to $400 an ounce, which is reportedly what the drug costs on the street. But that leaves the typical cancer patient spending $500 or more a month to get enough for adequate pain relief — in addition to the $100 annual fee the state plans to charge people to use the dispensaries.

One can imagine the case studies in college textbooks, where supply-and-demand theory crosses paths with charts created by M.C. Escher, the fellow who drew staircases that only went up and never down.

The issue is “diversion,” which is what potheads say they have in mind by lighting up, but this time it means taking a substance prescribed as a medicine and selling it as a recreational drug.

Then the textbooks will have to explain why, if the state law governing the dispensaries says they must be nonprofit enterprises, they can still make money and pay substantial salaries whose amounts don’t have to be made public.

Because they don’t deal with the general public, like nonprofits such as homeless shelters or volunteer fire departments, dispensaries fall under rules covering private nonprofits, such as condominium associations or even private golf clubs (which, come to think of it, also make money on the quality of their grass).

Where are patients whose monthly stipends run around $700 going to get $500 for a drug?

Well, we also read that in California, where dispensaries are already legal, voters may soon legalize recreational pot, which may bring the price down to around $38 an ounce.

Now there’s a potential boost for interstate commerce.