Indeed, evaluating an exam does not take that much time that it would be considered expensive.
That said, in my country (in EU), it's not indefinite tries. The fourth and later attempts (up to 8, I think) have oral exams in front of a panel of professors so that they can evaluate if there is actual lack of knowledge or if there is some sort of problem between the student and the professor. The student must by then pay for the attempt to pass the exam. It's not expensive, though, it's just another incentive to make the student really be sure to be prepared.
That said, in my country (in EU), it's not indefinite tries. The fourth and later attempts (up to 8, I think) have oral exams in front of a panel of professors so that they can evaluate if there is actual lack of knowledge or if there is some sort of problem between the student and the professor. The student must by then pay for the attempt to pass the exam. It's not expensive, though, it's just another incentive to make the student really be sure to be prepared.