What does a drug cost? It depends on where you live.

A new analysis by the consumer website GoodRx concludes that what people pay at the pharmacy for generic drugs can vary widely based on where they live. Some disparities obviously result from a higher cost of living—New York and San Francisco were the most expensive cities in the country for drugs.

A new analysis by the consumer website GoodRx concludes that what people pay at the pharmacy for generic drugs can vary widely based on where they live. Some disparities obviously result from a higher cost of living—New York and San Francisco were the most expensive cities in the country for drugs. But prices can vary widely even between similar cities in the same state: Cleveland's pharmacy prices were 2.5% above the national average, while not far away, Columbus had prices that were nearly 22% below average. Thomas Goetz, chief of research at GoodRx, said many factors are likely playing a role, such as the prevalence in some areas of big-box stores like WalMart, which sell generic drugs at cheap prices. Some of the price differences can be attributed to the "drug prices make no sense" theory, Goetz said. Generic drug manufacturers often charge different prices for versions of the same drug, and pharmacies can then mark up the drug in a variety of ways. "It's one more indication of how nonsensical drug prices can be, and how important it is to be vigilant about what you are being asked to pay," he said.