Huntsville was one of the first racially integrated cities in the South as a result of civil rights sit-in campaigns in the early 1960s. But the legacy of Jim Crow and redlining persists in the city as it does elsewhere in the region, with concentrated pockets of poverty.

One of those can be found at the city’s office for social services and food stamps, a low-slung, blocklong building flanked by a pawnshop and a Salvation Army thrift store. On a steamy weekday, public-assistance recipients and applicants waited for a bus under a shady tree.

“You’ve got to work hard, but it can happen,” said Edward Stokes, adding that he had often found himself one paycheck away from homelessness. He had just come from signing up for a program at the city’s career center.

Why inequity and disadvantage produce such hopefulness is not as unusual as it might initially seem. In the most economically stricken areas, residents understand that “nobody is going to help you,” said Roland Bénabou, an economics and public affairs professor at Princeton University.

So the only way to retain hope and motivate your children is to “think that if you just work hard or study hard, you will make it,” he said. “Otherwise there is no hope and no incentive to work, and then for sure you’ll remain poor.”

Mr. Bénabou also noted that whether you believe people get what they deserve in terms of rewards and punishments often varies widely by country.