I would have thought so. Both machines have internal power supplies so the cable is just that, some cable to get power from the socket to the transformer. Note I have never done this so it's at your own risk!
My eMac power cord has some plastic around it so it sits flush into the side of the computer, but I think the prongs are the same. You may not be able to plug it in all the way because of the plastic, though.