It is legal. One of the first sports I saw it happening was volleyball with volunteer assistant coaches at the school also coaching club teams. The harder you look, the more you will see assistant coaches at colleges coaching club teams in the off-season.