Not always, and I believe this is another reason that many pharmacies (such as Walgreens) are struggling.
More and more, insurance companies are pushing people to use mail-order pharmacies. Some insurance companies even own their own mail-order pharmacies that they pretty much force their members to use.
Not so much for one-time prescriptions, but for any chronic issue that people need refills for, yes.
I have to believe this is taking a pretty good chunk out of the profits of many pharmacies out there
That, and it seems that Walmart pharmacy has really upped their competitive game over the last several years, as has their brother-from-the-same-mother, Sams Club. Of course Costco is also very good. If you have a membership to Sams or Costco, (and maybe even if you don't), I highly recommend using them.
I will say, it's nice to have places like Walgreens around as a convince store, even if their prices are slightly higher, but if they were to go away I doubt it would effect me very much.