I don't think local drug stores can afford to be cheaper than a big corporate chain. But the pricing isn't the point, it's fostering competition against corporate monopolies.
Remember that the single purpose of corporations is to make more and more money. By their mandate to their shareholders, all measure of humanity is pushed into the background in favour of growth. The ultimate goal in that pursuit is monopoly: Being the sole supplier for their customers would allow them to dictate sales prices while being the biggest or even sole customer for their suppliers would give them leverage to shift prices in their favour. Their capital backing allows them to cushion out fluctuations in revenue and take losses, so they can afford to underprice and drive out competition, then crank up the enshittification to extort more money from their customers.
A (comparatively smaller) local store has less leverage to enshittify and exploit. Investing in their higher prices is an investment against that enshittification.
No, but their owners don't have the bulk buying power to negotiate for better prices with suppliers, the centralised management making the per-store-overhead more efficient, the employment power to push wages, the capital backing to run low prices without risking a bad month leaving a noticeable dent in their liquid assets or even run at a loss for as long as it takes for "lowest price" customers to flock to their stores and drive the local stores out of business.
Pharmacy technician here. When we bill a prescription, the processing information (either from your insurance card, or from GoodRX) is entered into the computer, then the claim (including the drug being billed, day supply, and patient information) are sent to the benefits manager (PBM), and returned to give us a determined copay to charge you. It's during this transaction, that by using GoodRX, your information has been volunteered to GoodRX as part of the billing process.
We do not determine copays - PBMs and your plan formulary do. You showing us a dollar sign on GoodRX does not guarantee you that price.
As an aside, my particular pharmacy does not accept GoodRX due to knowledge of these practices. It may also be interesting to know that GoodRX charges pharmacies a "finder's fee" for offering a discounted price e.g. you pay the pharmacy $25 for a $22 drug, and the pharmacy pays GoodRX $5. If you can still find independent pharmacies, support them! They will work with you.