Many have answered, but I will add a bit. First of all, Walmart is the one eating the cost here. Clearly MS is pushing the $349 price point for boxing day, and Walmart is kicking in the gift card as a differentiator.
Secondly, the $50 gift card does not cost Walmart $50, it's less. It's money that must be spent back at Walmart. They probably have analyst working for them that calculated the average profit on $50 worth of merchandise, and the average amount that people over spend their gift card and use real money. So while you see $50 in value, it may only be a $30 cost to Walmart. That's why you won't see a $299.99 console.