Start working from the Apple store?
I would test the outlets both places for proper wiring and voltage. Just because the charger works doesn’t mean it will work for the iMac. Plug the iMac in and test the outlet again. If you have a multimeter, plug just the cable into the wall and test the voltage on the female end.