A gift card also lets the store track your purchases (unless of course you give it away).
The anonymity advantage of cash is that it cycles through the register in a non-deterministic manner. If I buy a $20 bill (serial number 123) from an ATM, and it later winds up at PotMart, that is not compelling evidence I went to PotMart. If I bought a prepaid cash card and it was spent at PotMart, that indicates with decent probability that I purchased some weed.