Keeping the quality of a batch of gasoline intact from point of manufacture to point of distribution (terminal) isn't terribly difficult. It's difficult to adulterate material inside a pipeline without extreme disruption to the pipeline, and there are all sorts of checks & balances on waterborne vessel transport, especially when import / export is involved.
In pipelines as long as turbulent flow is maintained, each batch moves in plug flow kind of like a railcar without end caps with minimal interfacial commingling. If a batch of regular is followed by a batch of premium for example, to keep things intact quality-wise, a bit of the premium batch will be routed to the regular tank at the end of the regular batch / beginning of the premium batch delivery. In this case a small amount of premium is downgraded to regular as it meets or exceeds regular quality specs to keep any regular from contaminating the premium batch, as the regular does not meet or exceed the premium quality. So the regular tank gets a miniscule "boost" of premium as an economic way to do business transporting these materials, and the premium delivery is slightly shorted to preserve its quality. Small volumes in each batch but it adds up in the volumes transported.
Interfaces of gasoline and distillate, and of diesel and jet fuel, are "slopped" into a separate tank reserved for such mixtures known as transmix. The transmix is reprocessed to separate the gasoline & distillate components again.
The difficult area is transporting material from the terminal to the correct underground storage tank at the point of retail sale. "Missed Drops", events where the material drained from the delivery truck compartment doesn't match the contents of the station's underground storage tank, are the most problematic.
If you've ever pulled into a station that normally sells more than one grade and suddenly all the pumps are selling regular temporarily, chances are there was a missed drop of regular into the premium tank. There's less economic pain to just sell all the commingled material as regular since it meets and exceeds requirements for regular to clear out the tanks than try to vacuum it out and transport it somewhere to be reprocessed.
Riptide's experience may well have been such a missed drop that wasn't caught.
More difficult are missed drops that commingle gasoline & diesel - these must be reprocessed. The most dangerous missed drops I know of are those where gasoline is unloaded from the truck into the kerosene pump tank. These cause real damage & injuries when not caught before the commingled product is used for home heating.
A brief article
http://bulktransporter.com/fleet-managem...eaching-webinar