The value in the middle of the levels dialogue is not the middle gray but it is related to gamma as Andrew and Jeff previously said.
To be precise, it is the inverse of gamma (1/gamma).
Once you define your minimum (black) and maximum value (white), you normalize all the values to 1, so minimum=0 and maximum=1
To obtain the output value after gamma adjustment:
Output = input ^ (1/gamma)
The first attached image shows the effect of gamma=1, gamma=2 (1/0.5) and gamma=0.5 (1/2)
The effect of using gamma=0.5 is the same as duplicating the visible layer and selecting blending mode "multiply"
Some people mistakenly think that changing the center value in the levels dialogue is the same as moving the middle point horizontally in the curves dialogue. This is correct only for one side of the curve, since PS changes the calculation for the other side. This is shown in the second and third figure.
The second attached image shows that when you drag the center of the curve horizontally to the right, then you get the same effect as moving the center value in the levels dialogue.
In the case of the third image, dragging the middle of the curve horizontally to the left, has a different effect, where the highlights are affected more.
The calculation in this case is:
Output = 1 - ( 1- Input )^(1/gamma)
The fourth attached image shows the difference between the curves