It works as a resistor, so if a current flows through it, a voltage is generated. This voltage is applied to the other MOS gate and another current is generated.
You can obtain a desired current by changing the sizes of the transistors.
See Design of Analog CMOS ICs (Razavi).