A customer at a previous job was a fuels distributor. They told me that there is usually some leakage around the pig seals, so the gasoline near the pig might be contaminated with some other fuel - diesel, jet fuel, or whatever. And that the discount gas stations buy it ("Cheap Joe's Discount Gas"), but the major brands won't.
In cargo movements a simple foam pig pushed by compressed air or nitrogen is often used to clear the line after the pumping is finished and the pump has been turned off. In those cases where the line leading from the tank to the vessel was empty at the start of the movement, for best accounting you want the line to be empty afterward, and allow product settling time before the gager climbs the tank and takes their readings.
This can also facilitate sequential movement of different cargoes using a single line, after the pig has been caught and removed from the transfer path, the dry nitrogen then is used to purge the line until it is bone dry. To reduce cross-contamination, like if you were loading a parcel of acetone for one client followed by a parcel of ethanol from a different tank on the same clean-product manifold after that.
In the really long fuel pipelines, inspection or cleaning pigs can be used in the different legs but any one pig usually can not make it the entire length that the product will be traveling from entrance to exit. Foam pigs neither to better separate different grades of fuel so without a pig in between grades they end up with "transmix"[0] as the interface between gasolines and distillates becomes more blurred during the sequential transfers. As the transmix starts to appear at the receiving end it is diverted from the specification tank into its own smaller tank, rail cars, or trailers. Then subject to further processing back into two separate commodities again.
Players can implement "sushi pipelines" (pipes which transfer multiple fluids), e.g. [1]. It's fairly impractical, though; for a variety of reasons, most players prefer trains for long-distance transport of liquids.
Oh man that’s so cursed, but somehow also elegant.
For other readers, it’s called “sushi pipelines” because there’s a somewhat more common practice called “sushi belts” which is making transport belts that have every kind of item, and then filter inverters just take what they want, like at one of those sushi restaurants.
Sushi pipelines seem multiplexed more in the time domain than sushi belts (each square of belt can have up to 8 items at a time IIRC, so if you want to have more than 8 item types on it they’re also time-multiplexed, but that’s just a factorio implementation detail)
oh, so THAT is how they switch fuels.