I was given a dunkin giftcard
Dunkin gift cards expire? That's news to me, it's been a while since I've encountered expiring gift cards. Not sure that's even legal but maybe they expire in your particular state?
To answer your main question I buy gift cards with discounts/cash back all the time. It basically makes them cheaper than using cash. For example my credit card has 5% cash back for grocery stores so that gives me 5% cash back on gift cards purchased there.
Also a lot of credit card and stores do gift card sales where they'll do 10%-20% discount, or throw in a free gift card with a purchase.