Yes, it matters, as liquids are of different densities, so will weigh differently, even though they are equal in volume. A gallon of water weighs about 8.35 pounds. Other liquids may weigh more, or less.
It does matter what is in the gallon because it depends on the density of the liquid. Water is about 8.34lbs. per gallon. Some oils can be as low as 6lbs. per gallon. A gallon is a unit of volume, so all gallons take up the same amount of space, but weight varies by density.