Hi Jfalconebmop,
When you restore to factory setting using iTunes, either by recovery mode or through simply clicking 'Restore' on the summary screen, iTunes downloads a new copy of the latest iOS version compatible with your iPhone. However if you simply choose to 'Erase all content and settings' through the Settings app on the iPhone, it will simply remove all of your data associated with the device, but will not affect the iOS version currently installed (It will neither upgrade, redownload or downgrade the iOS version).
Hopefully that helps clear things up!