Drugstore chains who think their only competition are other drugstores are missing the market. I can shop at Target/
Walmart or even the local grocery store and find a wide variety of items with lower prices (and each has a pharmacy). Even if some drugstore has friendly cashiers or helpful customer service, most people are shopping based on who has lower prices. Items in most drugstores generally seem higher than you can find elsewhere.
In the case of many of the local chains that Rite-Aid replaced, there probably was customer loyalty because of good service and generous hours, but also because of locally-valued products. A national chain wouldn't replicate them the way that a local store could.
For example, growing up in South Louisiana, K&B Drugs carried a huge line of house-branded products, which were affordable, but actually better quality than most generics; such as K&B bandages, which actually stayed on. It was the place where we knew we could get our favorite Creole Cream Cheese ice cream for birthday parties, or Nectar Soda in bottles, or cheap-but-decent house-brand bourbon for making bourbon balls. They were always open earlier and later than every other store, and always open on Christmas (Purple & tan K&B gift wrap ended up under almost every tree, usually from that single uncle who always shopped on the way to MawMaw's house at 8 am on Christmas morning, and got his gifts along with extra liquor and ice. They had wrapping service, but only one kind of paper.) We all had purple ice chests and purple trash cans and purple fly-swatters, and shopped for holiday candy there because they stocked plenty of Elmer's brand candy and Hubig's hand pies. K&B was still a profitable company when Rite-Aid bought it, and they paid quite a lot for the brand.
K&B Purple is a unique color, and anyone older than about 35 who spent time in South Louisiana or the Mississippi Gulf Coast before 1997 can recognize it on sight. (And for those who wonder what it looks like, here it is. EVERYTHING that was house-branded was packaged in it, and also the paper bags at the registers. Every time I see it, I think of home. It was cultural currency.)

(My DD bought an expensive prom dress last spring, and when she opened the bag to show me, the first thing out of my mouth was "It's K&B purple!" It looked lovely on her, but it was absolutely the same color. My entire extended family said exactly the same thing when they saw the photos.)