I had an M1 Max machine with 32GB of memory and upgraded it to an M4 Max machine with 128GB of memory for local AI model experimentation.
It's sad that M5 (and M6) are so much faster at prefilling and other LLM-related operations, but I'm happy with the computer I got and will keep it at least 3-4 generations.
They really have radically improved the situation for prefill speed! But the generation speed is behind enough that you'd notice. An M4 Max is a great choice I think.