I can confirm this is common practice. We haul diesel in the very compartments that had gas in them the pervious load and vise versa. Depending on the terrain at the previous unloading area where the tanker is not level, we may retain anywhere from barely residue up to several gallons....and might even get transported in the same tankers. Of course after they've been emptied. There's inevitably a little bit that gets mixed and it's never a problem as long as it's a tiny amount.
If I know I retained more than a few gallons, I'll drain it off at the terminal before I load a different product. However, there are a LOT of loading terminals that won't allow you to drain off retained product and I'm sure the products gets mixed way more than people realize.
The only things you're not allowed to haul in a tanker that had gasoline on the previous load are kerosene and jet A. Most Jet A tankers are strictly dedicated though unless it gets washed out beforehand.
If your last load was diesel, you cannot haul a load of pure ethanol. The ethanol terminal here actually asks for the manifest for your previous load to verify. They are extremely strict about that.