It sounds like your G5 already has the AirPort Extreme card installed. To verify with both machines, just use the System Profiler utility (you can get to it from the More Info button under About This Mac in the menu bar). From the utility, just select Network > AirPort Card in the left column and in the right column if Wireless Card Type has a value after it, like "AirPort Extreme (0x168C, 0x86)" then you have the card installed.
Depending on how old your iMac is will either: not be AirPort Ready, be AirPort Ready or the AirPort or AirPort Extreme card will already be installed. If your iMac is AirPort ready, the problem is Apple no longer provides these card, but several third-party vendors do. Just do a Google-search for "AirPort Card." You should see, at least, a dozen listings.
The other option, albeit more expensive, is to get a third-party adapter as you suggested. One such vendor is
QuickerTek