This isn't a scientific study. You can't point to exactly what the differences are that caused the effect because their are too many variables and a sample size of 2.
If the calories were the same then the 'weight' they lost or gained won't long term changes.
My initial guess is that it's likely to be water loss on the 'healthy' twin who probably cut down on salt. And an increase in water retention on the twin who had UPF (which I suspect will have also been a higher salt diet).
I'm not commenting on whether ultra processed foods are good or bad. Just hate when this sort of report is cited as though it's equivalent to actual research. It doesn't prove or show anything other than that a set of twins ate a different diet which contained the same calories and weighed different amounts at the end.
Real weightloss (particularly thinking fat loss) is driven by a calories deficit. It doesn't matter what you eat - the speed at which you lose weight is entirely down to the deficit you're at. Fluctuations are almost always down to either fibre/physical food intake, water retention/loss or miscalculation on the deficit.
This is often why people often lose loads initially and then it slows. You overhaul your diet - often meaning you drop calories and salt. So you lose weight and water weight. Then it slows and people don't adjust for their new BMR and wonder why their weight loss is slowing. Or they vastly under eat and their BMR drops but they don't account for that.
Me and DH are serial yo-yo dieters. I lose weight consistently week to week based on my BMR and calories deficit. Ie. For every 3500 deficit I lose 1lb and it comes off at the exact rate you'd expect. This is because I'm very restricted on what I eat/drink, what time of day I eat and drink and when I weigh myself. I'm super consistent. DH is no where near as consistent so whilst he trends perfectly at the exact rate you'd expect for the deficit his actual weigh ins vary massively so his graph is all over the place from week to week.