Losing my 30 pounds last year ny running about 30 miles per week anf several half marathons, I have been eating like an animal. I am not convinced eating matters all that much in the larger puzzle.
Your eating habits don’t matter too much, beyond that you’re eating as healthy as reasonable.
But weight gain and weight loss do depend on how many calories you’re taking in as compared to you basal metabolic rate and activity level.
If you take in 3500 calories less than you burn, you will lose 1 pound. If you consume 3500 calories more than you burn, you will gain one pound.