The batteries that do not charge when plugged into shore power include both the house and chassis battery banks? Conversely, when on generator power, both battery banks will charge? Also, what is your inverter/charger make and model?
From your explanation in the original post, I would agree with the common denominator to be the transfer switch is not switching properly. I replaced our transfer switch this past summer. But first, as suggested, make sure your coach is receiving good shore power from the shore power plug through the cords and their connections to the transfer switch. For our 2002 to 2004 model year coaches, those transfer switches are becoming difficult to locate. I managed to locate a new one but its cost was almost $400.