I can explain something about at least one way that it's done (and I can think of others), because I've gotten to know people who are capable of these kinds of mental gymnastics. Ready for it?
How, you're asking me, does a little quote like this result in someone supporting a horrible policy of separating children from parents for, as
@Touring Mars puts it, the crime of seeking asylum improperly? Because that's exactly how it works. You see, to someone who has this philosophy, that luck is the invisible hand of hard work, you get to take credit for
everything that has ever happened in your life that is fortunate, and that includes something as simple as being born in a country you're willing to stay in. There are people who literally do not accept that anything that happens or has ever happened to anyone is the result of anything except their own doing. This allows you to turn a blind eye to everyone in need.
There's another level of this where people consolidate nations into their own individuals in their mind and decide that America as a whole is prosperous because of its hard work (which is mostly true, but also government) and that other nations are not prosperous because they are not working hard (which is mostly wrong, because government), and that all people within those nations share the blame for the state of those countries (which is kinda twice wrong).
So, honestly, the response that you may hear from some of this is "they should have worked harder to make a better life for themselves and not be in this position, they don't deserve to live here", which completely misunderstands the fact that America shares a border with one of the worst nations in existence today. It is exacerbated by the fact that Mexico creates little bubbles within itself to cater to American tourists who (take sometimes unknowingly significant risk to) visit that country on vacation and thereby create an impression of safety and prosperity in Mexico. How could anyone not be responsible for being destitute in a country with tourism dollars flowing and beautiful beaches and resorts?
Mexico is routinely toward the bottom of world rankings for safety, coming in safer than places like Afghanistan and Pakistan but not exactly way up the list. But Mexico is number one in the world at killing Americans.
https://www.forbes.com/sites/priceo...ountries-for-americans-to-visit/#21cc21e28a73
"Of the 1,356 killings that occurred abroad, 1,193 (88%) happened in the 25 countries listed above. And just one country, Mexico, accounted for 50% of those deaths."
That's of course due to the number of Americans the visit Mexico vs. other nations, but it's still very telling. Especially given that Americans tend to visit the safest parts.
Getting back to the quote, it's a misunderstanding of a different concept, which is that hard work can put you in a better position to take advantage of good luck. It's picking and choosing though really, because hard work can put you in a better position to handle bad luck too, and no luck. Hard work usually just improves your situation overall, and good luck can goes farther in good situations.