It would work if people would actually do it. It 100% works. Human nature is such that people would rather take a drug than change their lifestyle. I've done it myself but it requires a complete realignment of lifestyle to make lasting change.
At my lightest in 2023, I weighed 60kg. Currently I weigh over 95kg. I don't know what else people who hold your view can be told to convince them this problem is not one of willpower. I have the capacity to suffer. I've given up smoking. There is no escape from food.
The extra weight is not muscle, to be clear.
Ah, but what is food?
A cake made with sugar, flour, and butter will have a different impact than the equivalent number of calories in blueberries
Eggs and butter will make you feel different and will be treated different by your body than white bread and peanut butter and jelly
food is too general a term, it encompasses too many very different things