One could argue the student would absolutely hack their teachers' computer to find the answers if they didn't have fear of failing the class or getting expelled from the school.
A student knows what the consequences are in advance, and has to live with them if he gets caught. They are not merely respecting a "don't cheat" directive, they are trying to get a degree, build a career, mostly at their own expense, current of future (loans). If we imagine a student born yesterday with all the knowledge in the world, that doesn't have a concept of what it's like to live with the long-term consequences of their actions, I'd say they wouldn't think twice about cheating if it was the easier option.