It sounds like they could just block calls from Morocco and cut off much of the problem.
The problem is that French companies contract with telemarketing firms in France. Banning incoming calls from Morocco doesn't solve the telemarketing problem in any way. It's just a xenophobic / racist / whatever excuse to inconvenience people you don't like without making any attempt to solve the telemarketing problem.
FYI there is at least 900k+ people in France either immigrant from Marocco or with an origin and a 100k+ people with french nationality or origin living in Marocco
It's completely irrelevant how many immigrants there are, they live in France now they can just dial out to Morocco and we ban inbound calls from Morocco.
But racism and stupidity are usually good friends, so that checks out.