I suspect the lock is more about keeping other people's trash out than keeping theirs in.
https://c2.staticflickr.com/6/5244/5362943269_f1d08c480c_b.j...
There are stories about stores/restaurants calling cops when they catch you "stealing" "their" food from a dumpster. Essentially people taking food from dumpsters are treated like overgrown rats... Because https://youtu.be/P7J384IMuMM
Can be it be "stolen" if it's in a trashcan meaning it's no longer someone property?