The gallon designation on aquariums is just an industry standard and they generally hold at least the gallon size listed.
The outside dimensions of a 40B are a nominal 36" x 18" x 17", depending on manufacturer, and when you do the math, it equals a bit over 47.5 gallons.
For a true measurement of gallons, take the inside dimensions of the tank (or subtract the glass thickness of the panes), multiply them together and divide by 231, this will give you the actual gallons.
I have 40B's that are a nominal size of 36" x 18" x 15" and it equates to 42 gallons.
Eheim Pimpette #270
Eheim Pro II 2028; Classics Series -2215, 2217, 2260, 2262; Pro 2229 Wet/Dry