There are two uses of a cascode -- one is to protect a low voltage transistor from a high voltage supply; the other is to increase the gain of the circuit.
In the circuit (a), M1 drives into a low impedance node (S of M1A). Thus M1's gain (gm) is not reduced by driving into a high impedance. M1's drain current flows into M1A which passes it to its R load. Since M1A is fed by a current source (M1), its current is defined by M1. Thus the gain is gm(M1)*R. and imperfections caused by output impedance are dramatically reduced. In practice a resistor is seldom used; a current source would be more common.
In (b), M1A's current is IBIAS-ID(M1). Again, if IBIAS is constant, there is a 1:1 relationship between changes in M1's drain current and M1A, it's just that it substracts instead, but the gain is essentially -(same)