For a lot of those courses there's pretty much one way to solve the coursework, so all solutions are pretty similar. It's practically impossible to tell the difference between an original solution and a copied solution with the variables renamed and some code moved around. Or the student can look at the solution and reimplement it themselves, without solving it on their own. Sharing solutions can even get you expelled in many unis.