I used to work for a gasoline distributor several years ago. Most retailers in a particular area do get their gasoline from the same refinery/terminal as every other retailer in that area, with rare exceptions. They may even contract out the same third party trucking outfit to haul the gas. The basic gasoline stock is the same, with each brand using their own propietary "blend" of detergents/additives which is added at the filling rack while loading the truck. I would surmise that the "unbranded" outlets like Sam's, HEB, etc. still use an additive/blend of some sort, just like the majors. It is possible the majors like Exxon and Chevron use a blend of slightly higher quality, but I doubt most cars can really tell the difference. If yours can, use the major brand at least every few fillups to be on the safe side. There are times when water and dirt do find their way into storage tanks due to condensation, leaks, or other means, but trust me, a retailer would have to be pretty stupid to do that intentionally. Think of all the extra expense of fixing/towing people's cars, not to mention the bad publicity.
I would suspect the octane rating is more of a factor in drivability; some cars are designed to run optimally on the higher octane gas, but can often run on regular as long as there is no chronic knocking during regular driving.