Going to a store costs money. It also costs time. It's pretty easy for that to hit $5.
People need groceries. They're going to the store anyway.
If you can wait for a mail-order prescription to arrive, you can probably wait until your next grocery shopping trip to get it filled in person.
You haven't found a drug that's "more expensive", you've just found that shipping is a cost.
Going to a store costs money. It also costs time. It's pretty easy for that to hit $5.