Online pharmacies that specialize in generic drugs are at risk of having their supplies switched or contaminated because they order from manufacturers with reputations a notch below the big pharma brands whose packaging and product are sourced through a chain of custody that makes switching them out for something else a lot harder.
This means that they have to do some inbound quality control to ensure that what they believe they are selling really is what they are selling.
This is not quite right. I don't think any other pharmacy tests what they dispense. It's expensive, difficult, and the FDA doesn't seem to appreciate that their risk management strategy is being second-guessed. They recently issued a long warning letter to Valisure for doing it [0].
Note that ValisureRx (consumer pharmacy that dispensed lot-tested drugs) was sold to Medley Pharmacy, which just folded. Valisure is now just a testing lab.
Finally, it's not just a chain of custody thing. Even big generic brands and name-brands source a huge amount of active pharmaceutical ingredients (APIs) from China and India.
This means that they have to do some inbound quality control to ensure that what they believe they are selling really is what they are selling.