I think working from home is superior (for tech/programming work). In terms of work, it's the best way to not only avoid distractions, but also lay out your time in a way that is conducive to completing a project in the way you intended, and to let your ideas be fully implemented. This means projects finish sooner, much sooner than in a 9-5 environment. I believe that, when you know that you cannot escape the office until 5, that introduces some intellectual laziness and willingness to just kill or dilate time. The office does offer some perks, but they are not related to work itself, they are all about socializing / banter / feeling of being part of a team. Working from home does mean that home becomes workplace , and vice versa, but that is not necessarily a bad thing, as long as work gets done faster. People used to work mostly from home until the industrial era.
Personally, I have gotten a second job in an office for the 'office experience', yet i often do even this work at home, because i work faster there.
I think some "work from home" problems are problems of perception. It's not very well accepted to say that you work from home yet[1], making you feel like the job is somehow inferior. Also, the location of your home matters, if you live in a mixed commercial/residential place, it doesn't feel wrong to be at home and work all morning.
Discipline can be an issue until you establish a work routine. Much like driving to the office primes you to get into work mode, a morning walk to the local bakery can prime you to begin working at home.
1. https://www.youtube.com/watch?v=IW3lhfVpLL4