I suspect for the majority of people though, working from home lacks the mixture of accountability and shame that comes from having to work side by side alongside your coworkers/managers/bosses and at least have to do some level of work to appear minimally productive. If no one is watching you and you feel that work is just a means to an end you might be tempted to goof off or drag your feet.
I personally noticed that my productivity plummeted during work from home and skyrocketed when return to office was mandated. Probably it is at least somewhat related to the above. If I'm at home I might be tempted to go on a walk / do some chores / read a few chapters of a book / go workout / take a nap because I don't feel shame for it and no one can tell me otherwise. I would feel significantly more uncomfortable doing any of those things in the office and will more likely than not actually be forced to get some work done out of boredom and with no other options or distractions.