Don't Cheat.
As you have stated, there are students in your class who have cheated, and others who have not cheated. You have noted that cheating is pervasive and accepted. You observe that the majority of students cheat. It is not clear whether this has been the case for previous courses, and whether grades are already final for other courses. Are there any students who have not cheated on any courses, projects or exams? Have you or the other students learned the material, and how well?
As you have noted, students who cheat have harmed you and other students who have not cheated, and they have harmed the reputation of the school. The sad part is that because cheating behavior is accepted, you will finish your Master's and find it has diminished value because of the cheating.
Report the cheating to the professor(s), the dean, the office of student integrity. Report the cheaters, inform the school both that they cheat and how they cheat, and request that the exams be monitored to prevent cheating. Document everything. And do not cheat. Should the Uni do nothing, then you may get lesser grades, but you will have earned them.
Do not study for a PhD at a Uni that accepts cheating, that would further waste your time. Find (another) Uni where you can study and succeed. Have you learned and prepared well, and are you ready to succeed at the PhD level (without cheating)? Then find a Uni which aligns with your principles.
- Excuse: "I'm taking the last and hardest exams of my [M]aster degree."
Irrelevant.
PhD study, research, and work do not get easier. Whether the exams are hard or easy, do not cheat. Learn and master the knowledge. Find your own place. Earn what you can; accept what you earn.
- Constraints: "During the exams we aren't allowed to use anything else but our brain."
Irrelevant. Learn the knowledge.
This is one of the more asinine practices at Uni. Especially at graduate level. You should learn to think, synthesize knowledge, and seek deeper understanding. Exams should not be the only measurement.
Rote memorization is for elementary school.
- Cheating is Easy, Pervasive
"Cheating is pretty easy ... one has the lecture notes ... past exams with solutions on the phone and can easily consult them without being caught, therefore the majority of the students does it."
You stated that the Professor and Uni do not allow anything but brains.
The Professor and Uni should not allow these materials, and the Uni should have policies and procedures to enforce the integrity of exams.
- Fairness: "I feel at a disadvantage ... [cheaters] will take better grades in these exams [in comparison]"
Which is exactly why the Uni (and Professor) must express and enforce clear integrity policies. It keeps the playing field level.
Read about the Prisoner's Dilemma. Suppose you cheat, how does that affect those who do not cheat?
Your PhD application may already be impaired by your Uni's reputation, which may be known and have been damaged by tacit acceptance of cheating.
- Consequences: "[C]heaters will be be caught sooner or later by showing their own incompetence ..."
No guarantee here.
Sadly, some cheaters are not caught because they have learned the material, and cheat to make the exam easier. They harm their own preparation, but may still have learned enough to perform well. This may be a consequence of the weak exam format.
- Morals: "[S]hould I put morals aside ... and cheat if I need to?"
No.
Your integrity is important. Earn the grades you deserve on your own.
- Justification: "Is there any justification for someone to do it [cheat]?"
No.
You have already answered this question. Don't let others or even your own struggles diminish yourself. You have done your best.
- Temptation: "I've been very tempted."
Learn and grow.
Studying an advanced topic in depth is hard. It challenges our ability and forces us to think (hard), learn, and grow (when we can).
- "Even if I know some of them are better physicists ... anyway ..."
This is an interesting observation that some students (and cheaters?) are better than you. Which implies that students have learned the material, and there is a disconnect between the exams and the material. Clarify with the professor that students are not allowed to lookup answers. It appears that the problem is the exam format.
- Cheating should not and cannot be condoned.
You will face decisions in your life where you will need to choose between right and wrong. Make the right choice and stand by that choice. You will become a better person.
You are about to earn a Master's degree. You are an adult. Act like an adult. Accept responsibility.