What they gain with such threats is control over you with an installment of fear to ask for a raise or do anything that separates you from the company because that clause makes you unemployable for X years while it's active. The former employer (O) just needs to check your LinkedIn profile and send a notice to the new employer (N) that everything you write for N must be submitted to O so it can unilaterally decide if it actually belongs to them. It's absurd but I can believe companies try this because they have nothing to lose.
He refused the offer but I would like to know how common such a clause is, this is why I ask. Until now, I haven't thought about how careful you have to be when signing what one could assume is an absolutely benign and common work contract.
I am sure refusing the contract is tough decision for some but I think in a long term it is a wise move. Companies with such shaddy tactics usually are quite bad toxic places to work in and lack any reputation. Just check some other non-compete/confidentiality clause threads here in HN. You will find similar experiences.
From my experience it is extremely rare situation in EU nowadays, but I may be biased as I work with reputable companies from my network recomendations.