Its a hard science error propagation thing. Look at your equation:

(In) - (out) = (delta aka gain/loss)

Some background is that both are about the same, it takes a decade or so to swing from anorexia to the worlds fattest man. Lets say the (delta) represents a percentage of (In) / (Out) of perhaps 110% for a pregnant woman with quadruplets to maybe 99% very long term for an anorexic.

Watch the error propagation. The order of the (delta) error percentage is roughly equal to the order of whichever error is bigger, in or out.

I claim the percentage error of (Out) greatly exceeds 10%. Saying more than 50% makes me uncomfortable. Probably the true value is well in excess of 25%. This means any estimation or modification of (In) less than 25% is lost in the noise of the (Out) signal making the calculated delta meaningless. Garbage in equals garbage out.

Very few people screw around with their diet on a long term average more than 25%. Therefore any change they make will be lost in the noise of output energy level.

The way you get thin is by altering your diet so you are more active. Some diets screw around with your blood sugar, insulin levels, inflammation levels, all that is going to screw around with energy out flow. Large amounts of dairy products make me kinda queasy, so rather than going out for a walk or yard work, its sit on the couch. Large amounts of protein make me feel pretty darn energetic so I walk about more. Certainly the swing exceeds that experienced with having a cold vs being healthy. For some people with gluten issues its probably more like having the flu vs being healthy.

The TLDR is (in)-(out)=(delta) is useless because you need to characterize (delta) to pretty high accuracy to even figure out if your gaining or losing, and outside of a medical facility under observation you cannot characterize (out) accurately enough, or frankly, probably not characterize (in) well enough either unless you stick to industrially produced hyper consistent super processed foods, like all TV dinners every day, or always and only fast food or vending machines.

Rats on a treadmill hooked up to a timer with analytical balance measured food intake and no free will WRT activity, yes that equation could have low enough error bars on both (in) and (out) to be usefully applied to get a realistic value for (delta). Average american diet and lifestyle? Naw all you're going to get as an output is a white noise source, on a medium term large population average anyway.

(Ah I edit in this "real world-ish" example. Lets say skinny 20 yr old dude turns into fat 30 year old dude and he burns about 3000 calories per day to make the math easy. That means he averages a mere 103% of his perfect ratio of (In) vs (Out) where 100% would have resulted in no gain or loss over a decade. I theorize the error bars on (In) exceed three percent unless under constant medical supervision (every apple you ever ate was within 3% of spec? Really?) and the error bars on (Out) exceed twenty five percent, so the delta is meaningless WRT getting this dude either fat or thin. What does work is if his diet makes him sleepy / lazy / queasy / slow / blood sugar high or crash / whatever that screws up his (Out) enough to make him fat. And any change in (Out) is going to be more effective than any change in (In). So eat what makes you healthy, as long as you define healthy as "active" not necessarily classical stereotypical exercising)