When should the ground and neutral wires be separated at a subpanel? It depends.
First, what’s a subpanel? In my words, a subpanel is an electrical panel wired downstream from the Service Equipment, which is more commonly known as the main panel.
Next, what’s the deal with connecting grounds and neutrals together? In my words, if grounds and neutrals are connected together at a subpanel, they won’t have separate paths back to the service equipment. This means you’ll have current on the grounding conductor, which can be bad news for anyone working on the circuit. For a detailed discussion of this, check out Charles Buell’s blog post and video on bonding grounds and neutrals together at subpanels.
Pre-2008
Up until the 2008 version of the National Electric Code, there were two ways to wire a subpanel.
The first was with a four-wire feed; two hots, a neutral, and a ground. Grounds and neutrals were isolated to provide separate paths back to the panel.
Another way to wire a subpanel was with a three-wire feed; two hots and a neutral, with grounds and neutrals connected together at the subpanel. In this case, the grounds and neutrals have to be connected together. There were several rules for this method, however. This was only allowed at detached buildings, and the detached building had to have its own grounding electrode system. Additionally, there couldn’t be any continuous metallic paths bonded to the grounding system in each building.
2008 and after
Starting with the 2008 National Electric Code, the only acceptable way to wire a subpanel is with a four-wire feed. Two hots, one ground, and one neutral wire. The grounds and neutrals must be isolated. The two illustrations below, courtesy of the fine folks at CodeCheck (copyright © 2018), illustrate the difference between a service panel and a subpanel. Click on either for a larger version.
In short, it’s not always an improper installation if the grounds and neutrals are connected together at a subpanel. It depends on when it was installed and what else is going on.