1. Help the student learn (by applying theory in homework and encouraging internalization for exams), and
2. Verifying that students have learned the material
Cheating destroys both of those. A student can copy a solution to a general relativity problem, but that doesn't mean they understand it, and likewise they can obtain the exam before they take it and memorize the solutions, but then the exam only measures whether they've memorized the solution.
That is, cheating completely eliminates the purpose of obtaining an education.