Specifically, different systems of incentives and permissiveness will produce different behavior. I taught high school computer science for 4 years, and I can attest that cheating occurred in the classes I taught. I've also been enrolled part-time in Stanford's MS in CS, and have taken a number of the core undergraduate curriculum for CS majors.
I also went to a hypercompetitive US public high school with a number of brilliant classmates, many of whom also cheated.
My experiences have showed me that there is a wide spectrum of "cheating", ranging from students sharing things like, "I was at office hours and heard from the TA heard from the professor that topic X is going to be really emphasized on the exam, so you better study for it!" to outright blatant copying of other's code or answers.
What I've noticed as qualities of a learning environment that seems to increase the likelihood of cheating are:
1. The technological ease of which it is to cheat: it's easier to cheat on an asynchronous online exam than when you're taking it synchronously in a large classroom.
2. How "high stakes" the course is for students: for students at institutions like Stanford, where they be used to a certain level of academic success, failing a course isn't just a blow to their transcript -- it's a psychological blow to their identity as a "smart student." They may find it easier to cheat and maintain their self-image (and projected image to their family/friends) as a great student than to take the honest hit to their GPA, and have to give up their identity.
3. How "legitimate" the course feels: classes where the instructor is widely perceived as "unfair" or "incompetent" seem to have more cheating. Students feel disrespected ("How could she put X on the exam? We barely covered it!") or unvalued ("He doesn't even bother giving clear instructions on the homework assignments. Why should we respect his test?") may try to 'retaliate' by cheating.
4. How permissive the academic culture is around cheating: if there is widely perceived to be little-to-no consequences to cheating, or if cheating is seen as, "well everyone does it", then you will have a lot more cheating.
I'm sure the above is not an exhaustive list. My broader point is that in order to address the issues around cheating, we need to be more encompassing than simply punishing the cheaters. If the stakes are high enough, and the incentives strong enough, cheaters will still exist even if they are aware of the severity of the punishment.