Who cares whether the code came from our head or from something publicly available on the internet, or from someone willing to help us? As long as it wasn't an actual violation of the law. There's no good reason to create a separate set of laws for the classroom than the real world.
Can we just accept that this is how software is meant to be developed? Beyond the very intro level, the real assignments and challenges given to students should be about how to utilize, extend, integrate and optimize easily available existing code, not how to reinvent (regurgitate, rather) the wheel. This tests and improves understanding just as well as, if not better than making them implement from scratch. Evaluate the student's understanding and the quality of his output, not how independently they wrote the code.