I had the same experience when I was a TA a long time ago. Reviewing the code to a homework set I noticed that two students mixed up the naming of two variables (I think min/max were switched).
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.
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."