The point you're missing is that when you return your Ruin to the Supply, it goes on top. Now the top card of the Ruins pile is the same as the one that you revealed, and your opponent can gain it.
If you did not return your Ruins card, of if you have more than one opponent, then the top Ruins card may not be the same as the one you revealed, and if not, your opponent(s) do(es) not gain it.
More generally: Looter cards say "Gain a Ruins" which makes you gain the card on top of the Ruins pile. The specific wording means that it is agnostic to which Ruins is present. All non-Looter cards like Ambassador that name a specific card, do not consider Ruins together as a class, they consider the 5 Ruins as totally distinct. Ruined Village is not "a copy of" Ruined Mine, and so forth. So, if you are somehow forced to gain a Ruined Village, you can only do so if Ruined Village is on top of the Ruins pile. Non-top cards are not considered In The Supply, and you cannot dig through them. Such an effect would fizzle as if you revealed a card whose pile is empty.