On every receipt, by law, is a unique barcode encoding the shop and purchase value. That barcode, when scanned, leads to a government webpage (and doing your taxes involves scanning each barcode for anything deductible, so many of the receipts get scanned).
On that webpage, occasionally they ask for a photo of the best before label of the goods. The best before date usually includes the lot number.
Now, the government has a list of lots of serial numbers and associated retailers. They can now easily punish those who regularly sell stolen goods.