I think gift cards for an actual store (Best Buy, Amazon, etc.) are okay when combined with actual grocery purchases. I have been doing that since July 1. I just add an Amazon gift card along with normal grocery purchases, and have been getting 9 pts per dollar. If your account is being watched, I would do it in moderation just to play it safe. (I don't know where the line is)
What may not be okay are those cash like gift cards (Visa, MC, Amex, etc.)
I know of no grocery store that sells Costco gift cards. Only Costco sells Costco gift cards. You cannot use the Freedom Flex in Costco, because it is a MC.