The stores and credit card processors sell the information to Amazon, Google, etc...
There was an article in Forbes or Bloomberg or something recently that stated that Google now gets something like 80% of all credit card transaction data, online or offline.