I think the exact operation may depend on your sound card and operating system, but common to all systems it does not do anything magical - it just adjusts a sound card record level.
An extract from the Audacity wiki:
It is often assumed that Audacity controls the sources displayed in the input selector, but in fact the sources offered are governed by the drivers of the sound device that is currently selected in the Audacity Preferences. Drivers are a big issue on Windows machines, and it often happens that machines purchased new will only be supplied with generic Microsoft drivers. These may prevent the input selector from displaying all the possible inputs the device has (or any at all), or from linking properly to the system mixer (so that for example you end up always recording from line-in, or cannot apparently record at all, whatever source you choose on the input selector).
http://wiki.audacityteam.org/wiki/Mixer_Toolbar_Issues
So the answer is, if it works, it will do whatever adjusting the sound card does (via the Windows Mixer, the sound cards own interface, or whatever is appropriate for the specific machine). In some cases it may actually adjust the input gain of the sound card, in other cases it will scale the input signal (same as using the Amplify effect) and in other cases it does nothing. For many sound cards it scales the input - for example with high quality external sound cards it is usual to adjust the level on the sound card itself (with physical controls on the sound card) rather than on the computer.
If on a particular machine increasing the input makes the Audacity input level greater, but it never shows clipping in Audacity, then signal is being clipped or limited within the sound card - (this happened on my old computer with a SoundBlaster card). In such cases the input level should be set as you describe <<< find the lowest position that makes the Vu-meter nearly reach max on loudest passages, this should keep the highest dynamic range available from the source.>>>
Unlike recording on analogue media it is not necessary to push the recording level as high as possible - it is better to leave a substantial amount of headroom. This is particularly true if you are unsure at exactly what point the sound will start to clip/compress.
Here's the figures:
Recording digitally in 16 bit (on Windows, recording is usually 16 bit even with 24 bit sound cards due to driver limitations), the dynamic range is a nominal 96dB. Allowing for dither, you have
around 84dB's worth of bits to fit your waveform into.
If your input has a dynamic range (from peak signal to noise floor) of say 76dB, then that gives you 8 dB to play with, so as long as your maximum peak is within 8 dB of the top there will be no loss of dynamic range.
For best sound quality it is always better to allow too much headroom than not enough headroom as clipping or compression can never be accurately repaired.
Allowing 6dB of headroom will usually be about right, but if recording live sources (microphone recording) it is usually advisable to leave a lot more so as to allow for the unexpected extra high peak. For microphone recording I usually leave about 12 dB and if recording an unpredictable source will use a standalone compressor/limiter in line with the mic/computer input (or record on a 24 bit recorder and leave more headroom). When recording highly predictable and high dynamic range sources such as CDs or DAT, the input can be safely pushed higher, though it is usually better (and quicker) to transfer digital sources digitally (digital ripping) rather than recording them.
So I would slightly modify your statement and say find the lowest position that makes the Vu-meter nearly reach a reasonable level on the loudest passages.