I bet that this isonly possible because someone got the drivers for display, touch, camera, radios, etc, ...in binary form from the last oem image and put in the new one. sometimes they will backport the last kernel from android 5.1 into a 6.0 image so the binary drivers still work
I had a S2. It died on October 2016 after 5 years of good work. It still has some good points against more modern phones but I won't recommend to buy a refurbished one now. I won't trust the hardware to last much longer.