Thing is, it literally does not matter if the neighbors exam was the same or different - they intentionally made a decision to cross the taboo line and act in an unacceptable, punishable manner.
"just happens to glance at his neighor" and his answers is unacceptable, and it's fair to punish acting on that information. It does not matter if they tried doing it themselves. It does not matter which answer was right. It matters that they decided that copying is an appropriate response, which is was not.
If the student considers "So, in a fit of self-doubt, they copy the other student's answer." as plausible course of action instead of automatically discards it as unacceptable, then this is a behavioral issue that needs to be addressed and corrected; and addressing and correcting that behavior is arguably more important than whatever they learn or don't learn in that course.
The whole point of this "dilemma" is that if the student feels that this is unfair then this indicates a fundamental mistunderstanding of the criteria. To fix this, it might be useful to have a followup test for all the students in this class with the following questions:
What circumstances justify copying another student's answer:
A) Seeing a different answer than yours;
B) That other student being really good;
C) It being a full moon;
D) None of the above, nothing justifies copying another student's answer.
If anyone - especially the culprit - answers anything than D then they should be blocked from taking any tests until they complete some program on the University rules and ethics. If after this incident the student feels that they have a reason that justified their copying, then they're wrong and need to be educated until they know the correct answer. And if they refuse to accept that there is no valid justification and that they must obey the no-copying principle no matter what justification they have, then it's reasonable to expel them from the university.