The Late 2013 27” came in three versions [https://everymac.com/ultimate-mac-lookup/?search_keywords=iMac14,2|iMac14,2]
* 3.2 GHz Core i5 (I5-4570)
* 3.4 GHz Core i5 (I5-4670)
* 3.5 GHz Core i7 (I7-4771)
Your systems BIOS (EFI) is designed to support one of these three CPU’s. The 4770S might work I just don’t know.
Do keep in mind its running at a lower clock 3.1 GHz when installed in the 21.5” system. It might not run at this clocking in your 27” model.