I co-teach an upper-level undergraduate class where the students create independent programming projects - the computer science students couldn't copy anyone else in the class's code even if they wanted to, as it wouldn't make any sense for their context.
Perhaps the solution is to be more creative with how computer science education is taught? If the students are copying homework problems they don't understand, they're not going to do well on the projects or exams that might be part of the rest of their grade.