This is easily solved by a policy that 'legalizes' immigrants, which also tackles exploitation. This also ensures a more equal competition between locals and immigrants in the job market.
Most modern countries have those, which they tend to call periodic 'amnesty', as well as the possibility to be a legal taxpayer without having to change your nationality and the chance to apply for a permanent visa even from abroad.
The only reason why you wouldn't have any kind of smart policy in place is the desire to continue exploiting immigrant work, while keeping them disengaged politically and unable to have equal rights.
And you can tell that the policy in the US has been 'infected' by those ideals, which is an ongoing debate.
In many European countries, there's nothing that even resembles an immigration policy.
__________________
|