I'm wondering if the motherboard on the 2-port version of the iMac has the appropriate circuitry to support "ethernet via power adapter"?
In other words, even if you buy the power adapter WITH ethernet, it still may not work on the 2-port iMac.
Which is why (in the past) I've ALWAYS posted the advice here:
DO NOT buy the 2-port version of the iMac 24".
Get the 4-port version instead (which comes with ethernet as a "part of the package"...)
EDIT:
Looked on ebay, power supplies for the 24" iMac are available, but they ARE NOT cheap. Expect to pay around $200.
It might be cheaper to look for a USBc/USB3 hub with a network plug (ethernet) on it, along with a few additional USB ports.