Anecdotally and n=1, but I highly doubt this assertion. I lost significant weight without a diet change going from little exercise to swimming 2km 5 times per week.
I think what give people the impression of exercise not affecting the scale is that a little exercise won’t show. If you do yoga once per week, you might have the mindset of “I’m active, I do yoga, why aren’t I losing weight?” But it’s just not that much when you calculate the calories. Even at 10km of swimming a week, it’s not like I was shredding the weight instantly. I was maybe losing a bit more than 500g per week, which isn’t even significant enough to show if you aren’t consistent about weighing at the same hydration level, but over a couple of months and staying at that level it definitely shows. Now in comparison most others I know who casually swim would do maybe 400m once a week at a comfortable pace. That’s enough that you answer in a question are that “yes, I’m active, I swim each week” but not enough that you’ll significantly change your weight from it.
I think the saying shouldn’t be “you can’t outrun a bad diet” should really just be “you have to run a hell of a lot more than you think to outrun a bad diet”