Working as a lab instructor a lifetime ago, I graded two students' C assignments that both worked (mostly) but clearly without understanding what was going on.
It took me a while to figure out how they worked; as it turned out, they declared the same variables at the top of each function in the same order.
They didn't have globals, they weren't passing values around: the stack was being allocated across the same memory for each function, so the variables "just worked."
I ran a whitespace sensitive diff and noticed the only difference between the two files was the author name in the header.
The professor sent a sternly worded letter to the class about not cheating, and nothing else came from it AFAIK.
I never said anything about the accuracy of their code, but I was willing to explain how it worked so they could decide if they thought it was accurate. Most did not take me up on that offer, instead opting instead to bug people in their class until they found someone a) smart enough to help on assignments and b) dumb enough to help them. They didn't care about learning how their code worked or why, they just wanted an easy A.
The few who did take me up on my offer tended to be people who didn't understand the assignment to begin with and, after explaining the problem and how their solution worked, went out and did their own work. I always enjoyed those ones, they tended to want to do things legit but either were too nervous to go the professors/TAs or couldn't make office hours and couldn't get timely answers over email.
The people who just didn't care I was more than happy to talk about at at our weekly meetings. If their TAs weren't also tutors, our supervisor would keep them updated on who came in asking for a thumbs up on copied code.