The answers given above come close.

The first distinction to make is between physical and psychological quantities. Gain is a physical quantity and refers to the amount by which the input signal is amplified. Volume is a
psychological quantity that is actually
not the same as the psychological quantity of "loudness." Rather, volume refers to the perceived "size" of a sound. The perception of volume is affected by physical quantities in addition to sound-pressure level. Again, it is not one-to-one with loudness.
Now, virtually everyone is aware that, all other things being equal, increasing the gain of an amplifier leads to an increase in perceived loudness and perceived volume. It became practice (somewhere beyond the 1950s, IIRC) to label the
master gain knob with the psychological quantity "volume."
Let's get psychological quantities out of the way and consider each of the gain controls on a typical amplifier. The master gain control determines the
gain across the power amp stage. The control at the input determines the
gain between the input and the pre-amp stage and, as pointed out by DoubleMidi, typically retains the label "gain." Both controls-- the one between the input and the pre-amp and the one between the pre-amp and power-amp-- control gain. They both affect the overall gain of the amplifier. DoubleMidi discussed the reason why both controls exist. Their optimal use maximizes signal-to-noise ratio. The gain control at the input stage is typically adjusted for maximum gain before distortion and overload and then the master gain is used to make adjustments to achieve the desired loudness after that.
Some early hi-fi tube amps from the 1950s had a pair of controls, one labeled "gain" and the other labelled "loudness." Here's how they worked. With the loudness control set to 0 dB, one adjusted the gain control to achieve "concert level." Where the gain had to be set to achieve that depended on the loudspeaker one was using. After that setting was achieved, only the loudness control was used. As "loudness" was reduced, the appropriate amount of compensation (boost of low-frequency and high-frequency ends of the spectrum) was inserted to maintain, theoretically, a constant perceived overall tonal balance according to the
Fletcher-Munson loudness curves.