Data analyses from 46brooklyn Research, a new firm started by two people with experience in the pharmacy industry, outline historic trends of drug prices and costs in Medicaid programs across the country in an open, transparent format.

The bottom line: These datasets are the clearest examples yet that show specifically how some states are getting bad deals on prescription drugs — and how middlemen like pharmacy benefit managers manipulate the current drug pricing system for their own gains.

The details: 46brooklyn's visualizations use and merge several sources of federal data. The resulting maps and graphics detail what PBMs charge state Medicaid programs for certain drugs and what those drugs cost pharmacies. The spread between those figures essentially is the profit that PBMs and other middlemen collect.

Eric Pachman, a former manager of pharmacies, and Antonio Ciaccia, a lobbyist with the Ohio Pharmacists Association, decided to mine the data independently after noticing pharmacy margins tied to Ohio's managed Medicaid program were dropping everywhere. "It's exposing how the system works," Pachman said.

The data mostly show PBMs are reaping large Medicaid windfalls on generic drugs, not brand-name drugs (although clandestine rebates make brand-name drugs lucrative in other markets).

In numerous instances, after a brand-name drug loses patent protection and generics hop onto the scene, the costs of that drug decrease dramatically.

However, many states are not benefiting from those falling generic prices and are paying significantly more.

How it works: One of the most visible examples is imatinib mesylate, the generic version of Novartis' cancer drug Gleevec. A pharmacy's acquisition cost of a 400-milligram tablet of generic Gleevec roughly costs $84. But Indiana's Medicaid program paid middlemen almost $300 per pill, while Washington's Medicaid agency paid only $109 per tablet. Several other states paid more than $200 per pill.

"That's right — same drug, same time, different state, way different price," Pachman and Ciaccia wrote.

But this is not a one-off phenomenon.

Pharmacies were paid about $0.39 per unit of hydroxychloroquine, an immunosuppressive drug, and that amount has decreased steadily since 2015. But PBMs billed Kentucky more than $2.50 per unit.

Costs for a 6-milligram tablet of paliperidone, a schizophrenia drug, were about $12 in Ohio. But the state was charged more than $17.50 per unit, which the Columbus Dispatch has reported. The spreads for paliperidone were even larger in Arizona, Indiana, Nevada and New Hampshire.

"One of the key components of the system is that transition of brand-name drug to generic drug," Ciaccia said. "That is the core cost-containing measure of the U.S. system. And if you would allow a PBM or any third-party vendor to over-inflate that amount ... you are being set up to lose every time."

The other side: The Pharmaceutical Care Management Association, which lobbies on behalf of PBMs, said in a statement that "PBM clients," including state Medicaid programs, "choose the type of contracts they have with PBMs. These are tough, experienced negotiators who choose exactly the type of contracts, formularies and transparency levels they want. If one PBM doesn't give them what they want, a competing PBM surely will."

Reality check: Most PBM clients are in the dark about how drug prices, rebates and savings really work.

The big picture: If these kinds of games are happening in Medicaid, it's not implausible to imagine they are happening in other areas. And while the data highlight problems in the drug supply chain, they do not get at the high list prices that drug companies set.

Go deeper: The full datasets.