Are you talking about the gift card you got as a bonus when you bought a Mac?
If so, it depends on which card you have. In previous years, the gift card was for the Itunes/Mac App Store, but this year's promo is for an Apple Store gift card. The Apple Store gift card can most definitely be used at an Apple store or apple.com to (help) purchase hardware (new Mac) or accessories.
But even if it is an Apple STORE gift card, you cannot use it on the device that you are purchasing - effectively taking a discount on the purchase in lieu of the gift card. The gift card will be for a future purchase.