First of all, Apple's performance comparisons are against the mobile Nvidia cards, not the desktop ones. For example, the M1 Max comparisons with the "RTX 3080" were against the 100W mobile part, not the 320W desktop part. The mobile version is about 40% slower than the desktop one (something that I do find irritating about Nvidia's marketing). The desktop gaming cards are typically trading power consumption for performance. They're clocked well beyond the optimal efficiency point to squeeze everything possible out of them. Cutting the power target in half may only cost you 20% of your performance.
Another thing to note is that Nvidia pretty much holds all the high-efficiency binned dies for the enterprise cards. In terms of GPGPU, the data center cards are nearly twice the performance per watt of the consumer cards by going wider and dropping the clock rate.
Small edit:
The best benchmarks I could find suggested that the M1 Max was drawing ~105 watts with the GPU under under a large synthetic load and doing about 10 TFLOP/s of FP32. Let's assume the M1 Ultra is exactly double this and can do 20 TFLOP/s at 200 watts. The Nvidia A100 GPUs are the same performance but at 250 watts. The RTX 3090 is upwards of 36 TFLOP/s but approaching 400W of power draw.