That's only true for the bigger companies that can afford it. Smaller ones usually ask for you to be legally allowed to work in the country, at least that's been my experience.
Also your skill/experience plays a role. In a previous company I was only allowed to hire non-residents for mid or senior roles. Juniors had to be local.