Since you mention ML specifically, looking at some benchmarks out there (like https://tlkh.dev/benchmarking-the-apple-m1-max#heading-gpu & https://wandb.ai/tcapelle/apple_m1_pro/reports/Deep-Learning... ), even if the M1 Ultra is 2x the performance of the M1 Max (so perfect scaling), it would still be far behind the 3090. Like completely different ballpark behind. But of course there is that price & power gap, but the primary strength of the M1 GPUs seems to really be from the essentially very large VRAM amount. So if your working set doesn't fit in an RTX GPU of your desired budget, then the M1 is a good option. If, however, you're not VRAM limited, then Nvidia still offers far more performance.
Well, assuming you can actually buy any of these, anyway. The M1 Ultra might win "by default" by simply being purchasable at all unlike pretty much every other GPU :/