I grew up in a family of six, so at times, it would've been difficult to add another person to the table. My parents' response was always, "Honor, it's time for dinner. Becky, it's probably time for you to get home, too."
I think this is the way to handle it. Some variation on telling your own child it is time for the meal and also telling the guest to leave or hinting at it, like by saying, "It was great having you over, hope to see you again soon."
Father and son both dropped the ball. Son shouldn't have told the girl in the OP to just hang around, but Father, being the adult, really should have indicated that the OP was expected/free to leave.
And I wouldn't expect that all families could just invite another random person to eat a random meal with them (for any number of reasons), but it does seem a little "off" to me that the girl in the OP was NEVER invited specifically for a meal. Even if financial constraints were involved, I think there probably would have been a way to do it if planned in advance. So you can't afford to buy steak for everybody. So what? You can cook some hot dogs. It's the hospitality that counts, I think, and the joy of sharing with which the meal is served.
The thing where she cooked the meal FOR THEM and they expected her to leave, that is truly awful and suggests to me that maybe they wouldn't have ever invited her for a pre-planned meal even if they were multi-millionares.
But I could be wrong.