As of my recent doctor visit, I am taking ranitidine (aka Zantac) to manage my heartburn. I was given a prescription for this, although it is also available over-the-counter. My prescription is for 2 pills a day, or 60 a month.
I find prescriptions kind of a pain in the ass, what with the need to renew them and everything, so as I went to the store I thought I would probably just buy them over the counter. What I found was that a 24-pack (12 day supply, in other words) of generic ranitidine was something like $6 on sale. I knew my co-pay for prescription drugs was something like $10, so I went ahead and filled the prescription.
It turns out that ranitidine is one of my pharmacy's low-cost drugs, so the entire month's supply - 60 pills, or $15 worth of OTC stuff, was $4. That wasn't dependent on my insurance, it was just the pharmacy's price.
I have seen this before, where, either because of insurance or just in general, you can get prescription drugs more cheaply than the same drugs over-the-counter.
One of the things I dislike about the way that health care works in America is that, if you don't have health insurance, you end up paying more for things, and not just in the obvious way. For instance, my doctor's fee is something like $135 for an office visit, but my insurance pays her $45. If I were uninsured I'd have to pay the full $135 because I wasn't included in that negotiated rate.
And if I couldn't afford to see a doctor about my heartburn, I'd have to pay almost four times as much for my ranitidine.
This particular thing is one of those situations where each individual component makes sense and seems like a good thing, but the overall effect is somewhat perverse.