What would happen if there is no ground in a PMOS inverter?
If "B is 0" then you have implied a "ground". Ground is just a name for an electrical node by which other signals are referenced and need not be connected to physical ground.

If "A goes high", then you have implied both a ground and a positive supply rail.

If "A goes low" ditto.