If all your calories come from sugar even if you're eating fewer calories, you're still gonna be fat because well, biology.   Unless you're talking about fluid retention, such as with predisnone and other nasty corticosteroids that need a low-sodium diet if you don't want to swell up, that's not true.  John Cisna ate fewer calories and his entire diet was McDonald's food.  He lost 56 pounds.  He didn't have very healthy food, but he was eating at a calorie deficit.  It is difficult to eat nothing but sugar and stay at a calorie deficit because said sugar is calorie-dense yet unfilling.  A bag of gummy bears will set you back 760 calories, but you won't feel very full.  Healthy foods, especially the stuff you eat for a keto diet, are the opposite.