Let me spell this out for you in terms you will be able to understand.
1. UPS (or other parcel company) take receipt of your package as part of their business as a parcel company.
2. Another part of their business is acting as a customs agent on behalf of HM Customs.
3. They go through the Customs processes on behalf of HM Customs, levy the appropriate charges etc.
4. This all occurs simultaneous with their handling of your parcel and they have these magnificent things called bonded warehouses were they can store all these imported goods legally till the charges are paid.
5. If something comes to them in their capacity as a courier for which someone has no defence (ie a RIF without a UKARA) they act in their other capacity as a Customs agent (on behalf of HM Customs) and seize the article.
Now, all this doesn't occur with every courier. Royal Mail/Parcelforce actually use HM Customs to do this but UPS do it all.
This happens because otherwise HM Customs would be inundated with parcels and everything would slow to a crawl. Not too hard to understand is it?