The selling store's code applies
The merchant code comes from the store that processes the sale. A supermarket selling a restaurant gift card codes as a supermarket.
Gift cards bought online from a gift card site code as that site.
When you later spend the gift card, you earn nothing more, because no credit card is used.
When it helps
Buying gift cards for stores you already use, at a store that earns a bonus, can move spend into a better category.
It can also help use a rotating quarter's bonus before the quarter ends.
It only helps for spending you would make anyway.
The limits
Some issuers exclude gift card purchases from bonuses in their terms, or reverse rewards they consider abuse.
Many stores limit the number or value of gift cards per purchase, and some require debit.
Unused gift card balances are lost value. Do not buy more than you will spend.
