There's a big risk that they'll start off OK with long commutes, overnight accommodation, etc., but then find it's too much and try to wriggle out of commitments to be in the office. Also the risk of them citing disability discrimination or otherwise formally requesting flexibility so as not to have to go into the office as often, or at all. Or after a few months, decide the time/costs are too much and leave anyway.
Unless the applicant is exceptional, I don't see why a firm wouldn't employ a more local person to reduce the risks.
Recruitment is incredibly time consuming and expensive, so an employer has to look at the likelihood/probability of the applicants staying for the longer term, being flexible, etc.
If two people are equally competent to do the job, then it's entirely common sense that they're take the one living closest to the workplace, if workplace attendance (even infrequently) is required.
Back in the 80s and 90s when I was responsible for a lot of recruitment, I'd tend to favour the more local/nearby applicants, and that was long before the internet and home working. It was simply because they'd be more likely to get into work on bad weather days, if their car broke down, if the trains were on strike, etc. The closer they were, the more chance they'd be able to make it in, or at least not be too late if they were delayed. It's common sense. Of course, for "equivalent" applicants only - I'd never chose a local applicant over a more distant one if the one further away was better in terms of experience, qualifications, or a better "fit" for the job, but all other things being roughly equal, I'd go for the closest.