Every gift card you buy has a magnetic strip on the back, similar to the one on your debit or credit card. This strip is basically there to record the running balance, the card number, and the PIN number if it has one.
The gift card thief has found a way to retrieve the information contained in that magnetic strip using a simple reader that can be bought very cheaply on the internet. The thief will then go to one of those racks filled with cards and read the information from them. Usually, they will target the cards with larger dollar amounts printed on them (even though they are not yet activated) as well as blank cards and lower denominations.
You may think that the packaging on the gift card can prevent that, but it’s no barrier. Most of the time the card can be lifted from the packaging, read, and replaced. Sometimes, the strip is visible in spite of the packaging. And many cards aren’t even placed into a wallet or gift card holder until after they’ve been activated.