They're losing weight elsewhere, usually from something like hyperemesis or they are overweight to start and start exercising or similar.
The baby, placenta, extra blood volume, that has weight. It's possible not to.gain as much during pregnancy but gaining nothing or losing weight means it's coming from somewhere.
Typical weight gain breakdown (the 20-30 range for someone at a healthy start weight, this is inviouslyna massive generalization):
"Baby = 7.5 pounds
Amniotic fluid = 2 pounds.
Blood = 4 pounds
Body fluids = 3 pounds
Breasts = 2 pounds
Fat, protein and other nutrients = 6 to 8 pounds
Placenta = 1.5 pounds.
Uterus = 2 pounds. "
https://www.marchofdimes.org/find-support/topics/pregnancy/weight-gain-during-pregnancy