This follows the same logic as banning calculators when teaching people basic arithmetic. When something is a replacement for your learning, it should be banned, and when it is an augmentation, it should be encouraged.
You may think it's ridiculous, but many people today can't calculate a 20% tip or add two prices together without a calculator because the constant use of calculators has caused their arithmetic skills to atrophy. This seems like a silly gripe, except a lot of other skills are built around these basic ones: for arithmetic, the ability to estimate the cost or time taken to do something is all based on tricks you learn when you are trying to learn mental math. Society is not worse off for this (enough of us still know how to do these things), but many people are poorer, both intellectually and monetarily, due to a lack of arithmetic skills. And no, this lost knowledge of arithmetic is not replaced by a knowledge of higher math - it tends to come with a fear of it.
The same applies with text-generating AI. In terms of writing, if you don't learn to write dumb essays about books, skills like learning to construct an argument are much harder to pick up. For people writing code, learning to slog through writing and debugging a doubly linked list (something ChatGPT can reliably generate for you today) leads you to later being able to slog through debugging B-trees or lock-free queues (which ChatGPT definitely cannot write for you).
I think there is a very compelling argument along these lines for low-level courses to ban AI tools. However, higher-level courses probably should allow students to add them to their repertoire, where they are an aid and not a crutch. This follows how mathematicians and engineers learn to use calculators and computer algebra tools, which seems to work well.