Kazakh didn't buy them, they inherited them. When the USSR broke up they were stationed there, and like most of the former Soviet republics they kept them. Some sold their planes on the market, some sold them back to Russia, but some like the Ukraine and Kazakhstan merely made them into their own air force.
The sticking point is maintenance. As long as Russia provided spares support at reasonable pricing they could keep using them. My feeling is that they did because of the importance of Baikonaur and the KAF has had no problems keeping their planes running well.
When the new facility, on Russian soil, is finally finished and the agreement with Kazakhstan over using Baikonaur expires, the dynamic might change. Right now, Russia is "over a barrel" with Baikonaur and has to do almost whatever Kazakh wants that isn't unreasonable, a situation I'm sure they're eager to change ASAP.