What you pay at the pharmacy for generic drugs can vary widely based on where you live, according to a new analysis by the consumer website GoodRx.

The study, which looked at 500 commonly used drugs in 30 American cities, highlights just how unpredictable drug prices can be. The cost of common drugs like the generic version of the cholesterol drug Zocor, or the diabetes drug metformin, differ significantly from coast to coast.

GoodRx looked at the average cash price of the drug at a pharmacy — something not every consumer will have to pay. Most people have insurance coverage for their prescriptions, and consumers can often take advantage of discount programs. But a growing number of people are being asked to pay for a greater share, sometimes with a deductible.

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 percent above the national average, while not far away, Columbus had prices that were nearly 22 percent below average. In Cleveland, the generic version of Paxil, the antidepressant, costs about $46.94, while in Columbus, someone would pay $20.87.