Not everybody across the world is doing that in equal measure (I've not heard of a concerted effort by Europeans travelling to the US to give birth in contemporary times).
People migrate for economic opportunity. South Africa is not a rich country, but sees millions come in from the SADC for this reason, despite some pretty big social problems.
The US is nothing special, it's just a particularly large market of economic opportunity with a history of allowing in migrants. If China was significantly more migrant friendly, we'd see the same happen there. None of this specifies that the US has some secret recipe for success that papers over some of its obvious and glaring deficits.