Stealing one's own material through recycled scripts from other shows is sad to say, a tradition that would go back to the days of radio when an old script would be dusted off to give the writers a respite or when there was an impasse in trying to come up with something.
This was easier to get away with in the days before home video existed and the audience's specific memories of older shows would be rather dulled by time and lack of exposure. Today, I don't think they can let themselves do that kind of thing any longer.