The public welfare system in the 18th and 19th centuries was a local, not a federal, obligation, patterned on the English "Poor Laws". The Poor Laws established the government's responsibility to provide for those who could not care for themselves, but left the details about how to do it up to the local town or county officials.
Initially, "paupers" were given cash payments called "outdoor relief", which was paid for by the taxpayers of the city or county. As the cost of outdoor relief increased, governments decided to create a more cost-effective system, called "indoor relief". They built poorhouses, almshouses, poor farms, county infirmaries, asylums, or county homes to house people who were too expensive to support with outside relief, and required welfare recipients to go to these facilities if they wanted assistance. In some states, the state owned and operated some or all of the poorhouses, in others, counties or cities ran them. A few states avoided the cost of building and maintaining poorhouses by boarding paupers out, sometimes with their own relatives, or paying farmers to care for them. Tennessee actually auctioned their paupers off to the lowest bidder. (The Atlantic Monthly, 1881)
A common concern of the public at that time was that the opportunity to get free room and board would be so attractive that people would deliberately pretend to be poor so they could live an "indolent life" in the almshouse at the expense of the taxpayers. Consequently, poorhouse life was made as unappealing as possible. The "inmates" were expected to wear a poorhouse uniform rather than their own clothes, and they were not allowed to leave the poorhouse. Many of the poorhouses had attached farms so they could produce their own food and be self-sufficient, and they were often located far out in the country to keep them out of sight. To offset the cost of care, the inmates were expected to do the work needed to keep the operation going. Even the older women were given jobs like sewing.
(See 1809-1930: History of Hospitals in Michigan.)
Operators also were careful to check before accepting someone into the poorhouse to see if anyone else could be supporting the potential inmate. If a poorhouse applicant had adult children, he might have to prove that his children were unable or unwilling to support him before he would be accepted. The local government was only responsible for people from their jurisdiction, so they could, for instance, refuse entry to a widow who grew up somewhere else. Someone who had lived in several places might find that none of them considered him or her eligible for taxpayer support. This happened often enough that there were bands of poor homeless people who roamed from place to place, staying in each one only until the authorities ordered them to move on.
Concerns about the high cost of operating the poorhouses lead to other indignities. For instance, New Jersey law included a provision forbidding emancipation of slaves who were 40 years old or more "for fear of the distant contingency, that this freedman might become a public burthen to the township, by being a pauper in his old age, and rather than subject the towns to that they preferred to let the man and his posterity remain in slavery." (Library of Congress: Slaves and the Courts, 1740-1860)
As time passed, the poorhouses became catch-alls for anyone who couldn't survive in the outside world, and they became home to poor dependent elderly people, where they lived in the same rooms with "miscreants" (petty criminals), "inebriates" and "intemperates" (alcoholics), orphans, unwed mothers, and the "feeble-minded" (mentally ill).