They calculate the cost to make something in-house. They calculate any costs associated with purchasing an item outside. Then they compare the two.
According to one estimate by the Brookings Institute, it will cost parents about $310,000 to raise a child to age 17 in the United States. That cost is blind to the costs borne by the greater public...libraries, public education, employer-paid healthcare insurance or Medicaid and so on as well as costs that occur after age 17 such as University educations and legal services. Also missing from the equation is the "opportunity costs" of lost income if one parent chooses to drop out of the workforce and parent-in-person.
If 2 million, young-but-working-age migrants are pouring across the US border every year, that equates to a $620,000,000,000 yearly cost-avoidance.
The obvious question is "Why does it cost so much to raise children in the United States?"