I love this question because it can be formulated mathematically. I was thinking about it recently because Chase freedom will have 5% cash back at grocery stores from April-June this year. Towards the end of June, I plan on buying a gift card for my grocery store to use in July, August, etc.
Basically there's two competing factors: the immediate savings gotten by purchasing at a discount, and the lost investment growth since the money is now "locked up" in a gift card, instead of earning interest along with your investments. How much you should purchase in a gift card depends on your investments growth rate, and the discount you get on the gift card. Obviously, if you invest your money very well, you should buy less in gift cards, and instead just draw money out of your investments on a need basis. And if you can get a really high discount on a gift card, say 20%, then you would probably buy more of the gift card.
Here's a spreadsheet I made recently with parameters you can change to help you decide.
Simplifying assumptions:
- You invest any extra money (If I wouldn't have done anything with that money, just ignore all this and buy a giant gc...) and it grows at a consistent APR that is known
- I make one purchase per month equal to my whole budget
- The discount % of your gift card should be calculated carefully. If I must pay for my gift card using cash/debit, and the discount is 10%, I actually consider that roughly 8% because my alternative is buying groceries normally with my 2% cashback credit card
Example calculation: Your grocery budget is $100/month, and you have the opportunity to buy a $300 grocery gift card at 10% off, which will last 3 months. Your investments grow at 5% per year, which corresponds to a monthly interest rate of 0.407%. Let's see where we end up, if we start with $300, in the case that we (i) buy the gift card, and (ii) don't.
In case (i), you buy the gift card, spending $270, and leaving you with $30 in your investment account. That $30 grows to ~$31.28 at the end of three months.
In case (ii) there's a little more computation necessary. Pretend we're beginning January 1.
January 1: Spend $100 on monthly grocery trip, leaving $200 in my account.
January 31: That $200 grew to $204.36 after one month.
February 1: Spend $100 on monthly grocery trip, leaving $104.36
February 29: My account grows to $106.35.
March 1: Spend $100, leaving $6.35
March 31: It grows to $6.40
So with these numbers, I should buy a 3-month's supply of the gift card. The spreadsheet I made is basically the above computation with the guts hidden.