There can be legal issues from the candidate's side too -- people on an H-1B visa in the US may not be able to accept payment for work outside of the company they've been hired by.
And also not very enforceable in some areas. I got legal advice on this from my own attorney some 20 years ago. I had created a piece of software on the side while working under a contract that said something similar. The software took off and I was worried about it. He advised me that worst case would be paying the company the money I earned while under that contract, but even that was a stretch.