Part of the problem is simply that you're trying to combat rationality. Regardless of what level you're teaching, grades are important. They control scholarships and school admissions (be they undergrads or high school students). Doing poorly on an exam can be a death sentence to a grade, and that can mean a lot of bad things for a good student.
Most students really, truly understand that it's better to understand the material. They really do, however, the grade comes this or next week. And that grade will have an influence (however minor on its own) on their academic career. If they need to understand something, they can reread the textbook over the summer. I always try for understanding, but there have certainly been times where I had to say "okay, either I can try to deeply understand this and possibly fail or I can spend the next two days memorizing these special cases so I pass the final". It's unfortunate, but rational and necessary.
The solution really depends how much control you have over the course. Can you reduce some of the exams to weekly quizzes with less grade impact? That can be a good way to test basic competency and familiarity with the material without the grade pressure.
If you absolutely have to abide by the exam schedule (or it's external to your class e.g. a GRE prep or you're a tutor for someone else's course), you could make your tests require a deep understanding; structure questions as proofs and conceptual short answer questions. I do warn you, though, that this may backfire horribly for any number of reasons. Not the least of which is that it's hard to regularly and consistently make a large number of high quality conceptual questions that are really fair to beginners at a topic (often we become blind to the difficulty of conceptual questions about concepts we understand).
Overall, I think this is a very common question in all areas of education. "How can I get students to try and understand instead of trying to min/max their chances of getting an A?" And I don't think there's a perfect answer unless you're in a position to change the system. (Which isn't to say I'm for abolishing all grades, necessarily, but the entire institution is so wrapped up around various metrics that you can't really blame students for recognizing the reality of their situation).