In SME there are two crises facing an on-site development team:- first of all they will be expected to 'pick up' all sorts of general tech. support and queries, which is disruptive to the coding flow; they will be expected to be present as 'techs' in marketing pitches - which can be great, but also means not doing their job.
SME tend not to even consider 'working from home' as an option, which can be disconcerting for a modern developer who can use anywhere quiet as a coding location as long as there's some sort of workstation/laptop with an IDE and an internet connection, stuff to eat/drink, a toilet, and a bed.
Working outside the office is (for most developers) really tough for keeping hours - some coders are fine until distracted and then lost. Others just don't stop until they are way beyond productivity. (Every coder knows that they start writing bad code when they are tired).
In larger organisations you can suffer from those and other problems - if you work on-site and you are half-competent, you will be promoted to management, often dealing with the more inexperienced/less competent. Alternatively you will be expected to produce stuff way below your ability, which is just boring. Or you will be pushed into crunch-time continually which is just straight abuse.
TLDR; I don't really think that there's a strong correlation between locality and productivity, whereas a harmonious small team with a good leader (who also codes, and understands the needs and limits of the group) directly correlates with productivity.