They're looking to make sure it's an actual Walmart receipt and that the customer didn't walk in with a piece of paper, pick up some items and walk out.
They often check the date, time, and store. Just like scenario above, they want to make sure someone didn't shop on one day at one store, come back a few days later at another store, pick up some items, and walk out.
They usually mark the receipt with a highlighter or marker to prevent someone from using the receipt again.
Well, I guess that makes sense then. And they do mark it at my Costco.
I always thought it was a gesture, it never seemed like they were checking item by item. What you say makes sense though.