2 quarts is half of a gallon, 4 quarts is one gallon. So the question is pay 3 dollars for half a gallon, or pay 3 dollars for one gallon? Which would you do? they both are the same price, but one is half as much.
Therefor, 1 gallon of milk is a better deal.