On the handle of each trolley or cart is a slide to entrap the coin, and dangling below that is a chain carrying a key affair of fairly simple profile. When you collect your trolley, it will be locked to the rank by having the key of the one behind plugged into it. Inserting your coin releases that key, so you can pull your trolley away. When you are done, you return it to the rank and plug in the key of the one behind it, which releases your coin. The chain is too short to allow the key hanging from your trolley to release your coin.
It did once occur to me that if one were to reproduce the key (or snip the chain holding an original one), he could wander round the store with it, pocketing the coins from those trolleys whose users were distractedly wondering which tin of baked beans to buy. A false beard would be needed, because of the CCTV.
Andy