https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Pf...
Put a coin in the drawer and close it, the chain of the next cart pops out the back and you can take it. On return, you push the chain back in, the drawer pops open and you get your coin back.
Store employees just occasionally balance cart numbers between the corrals, if there's multiple.
Put a coin(or any coin shaped object) in and a simple mechanic latch releases the chain, plug it back in and you get your coin back.
To get one, you insert a coin (or a plastic token - these are usually given away as freebies by many companies if not the stores themselves) and that unlocks the chain.
It's not about the money, no one earns anything from this. It's about putting something that you own (can be worthless, the emotion counts) in the cart which you can only possibly get back if you return the cart to any number of bays on the parking lot or next to the entrance.
https://en.wikipedia.org/wiki/Smarte_Carte looks like it might be the airport system you have in mind.
The usual European shopping cart system works with a coin deposit, chains and mechanical locks on each cart, as described in several other comments.