Midgrade (90 octane) and Premium (93-94 octane) are not higher quality gasolines, they are the same gasoline with slightly more additives.
It is a major scam how much gas stations charge per gallon for some micrograms of ignition retarders and detergents.
What happens in pipelines is a lot of the same stuff goes into the pipeline aka "one big slug" at the same time. In between slugs stuff gets mixed and that becomes transmix which gets bought and sold (at a discount) and usually reprocessed and reused. Pipeline scheduling is done to reduce transmix - if high grade gasoline is next to low grade gasoline the transmix could potentially be sold as low grade gasoline.
Octane is a measured property of the final mix. Some things boost it and so on, so it can be added in some sense.