The Afghan Air Force buys Russian helicopters from the U.S. Navy. Actually, the U.S. supplies the money for Afghan military equipment. To reduce corruption, the U.S. insists on handling the purchase and delivery of things like Russian helicopters. The Afghans, and the Iraqis, prefer the Russian helicopters, because they have used them for several decades, and they have personnel with experience in operating and maintaining them.
The Afghans are not happy with being unable to handle procurement. But it's American money, and the Americans will obtain whatever (within reason) the Afghans want. The U.S. has also taken this approach for Mi-17s obtained for Pakistan, and for the same reason (to overcome local bureaucratic delays, and corruption.)
The Mi-17 is the export version of the Russian Mi-8, a twin-engine helicopter, roughly equivalent to the U.S. UH-1. But the Mi-8/17 is still in production and is the most widely exported (2,800 out of 12,000 made) helicopter on the planet. The Mi-8 is about twice the size and weight of the UH-1, but only hauls about 50 percent more cargo. However, the Mi-8 has a larger interior, and can carry 24 troops, versus a dozen in the UH-1. The UH-1 was replaced by the UH-60 in the 1980s, while the Mi-8 just kept adding better engines and electronics to the basic Mi-8 frame. But the UH-60, while weighing twice as much as the 4.8 ton UH-1, could carry as much as the 12 ton Mi-8. But the Mi-8 costs about half as much as a UH-60, and the larger interior is popular with many users. Russia also offers lower rates for training pilots and mechanics.
The U.S. has access to Mi-17s because it has led the way in obtaining this model for Iraq and Afghanistan (both long time users of the Mi-17.) The Afghan Mi-17s were bought, new, from the Russian manufacturer. The aircraft were checked out by the U.S. Naval Air Systems Command (NAVAIR), painted in Afghan colors and equipped with some American electronics. The most recent purchase, of four Mi-17s, were delivered 65 days after they were ordered last July 30th. Even the Afghans were impressed by that speed.
Afghanistan doesn't actually have an air force, but rather a Afghan National Army Air Corps