If Apple has stopped signing an iOS version, then there's no way to go back to that older iOS version. It wouldn't be considered illegal, per se, just not possible (without modifying the hardware, such as replacing the logic board with one that has the iOS firmware installed. So, you would need some luck to find that...)
One way to get that older iOS version: Find an older iPhone (an iPhone 5) that has not been upgraded from iOS 6
Sometimes you do get lucky on eBay.