How does this MOSFET circuit work?
You're missing the resistance connected to vOUT. Yes, this resistance will create a voltage divider with RL, resulting in a voltage smaller than VS.

However, if the resistance is very high, such as that of a CMOS input, the resultant voltage will be close to 5V.