Not sure if this is a joke or not, but they didn't. The ghouls will die of thirst if you take the water chip and don't find a source of water to them.
Apparently this bullshit with ghouls started with Fallout 3. There's a glowing one called Keller Senior that survived for 200 years being stuck in a bunker with only very few supplies and the flesh of his relatives. But then New Vegas has ghouls working like they do in Fallout 1 and 2, with Harland saying he needed to eat radroaches and drink pipe condensation to stay alive.
To finally end this madness, Fallout 4 is not even consistent with itself. There's a ghoul called Kent Connoly that needed sustenance to survive and this is revealed in a terminal. So Ghouls do need to eat and drink to survive.