But let's stick with a Sorcerer for a moment. Let us say that you take Invisibility at level 3, then at level 4 you take Shadow-Touched to get a free casting of Invisibility. Well, Shadow-Touched says "You always have that spell and the Invisibility spell prepared. You can cast each of these spells without expending a spell slot. Once you cast either spell in this way, you can't cast that spell in this way again until you finish a Long Rest. You can also cast these spells using spell slots you have of the appropriate level. The spells' spellcasting ability is the ability increased by this feat."
So, you "forget" Invisbility as a Sorcerer spell, as you are allowed to do here "Changing Your Prepared Spells. Whenever you gain a Sorcerer level, you can replace one spell on your list with another Sorcerer spell for which you have spell slots." and learn a different spell.
If you were to hypothesize a Sorcerer Subclass that gave Invisibility as a Subclass spell, then I suppose in this instance you would have the spell from two sources, but again, this is distinctly a situation where the player has no choice in the matter if they want Shadow-Touched. But as long as you have a choice, since the spell is always prepared and you can cast it with your spell slots as normal, you gain no benefit from learning it via the feat and taking it as a prepared spell, and personally as a homebrew, I would be quite tempted to simply allow the character who is "Stuck" with getting the same spell twice via a subclass static list, to swap that spell with a spell of the same level. Otherwise is feels like you are gaining less for your choices than otherwise intended, to me personally.