As many people have pointed out, it isn’t necessarily an insult. It’s a shorthand way of saying someone comes from the United States, regardless of their skin color.
Gabacho works the same way.
If a foreigner quickly reveals that he isn’t from the US, then the Mexican who called them gringo will often call them something else, often exhibiting an amazing lack of political correctness.
If the person is blond, then they’ll become güeros.
If the person is black then they may be called negros. (Which, in Spanish, doesn’t carry the same racial weight. It’s just used as a description.)
The notable exceptions to this loose “rule” are Asian looking people (who will be called Chinos, regardless of their origin), or Mexican-Americans, who will be called pochos.
One thing with gringo and these other examples though: While they can be used innocently and in a friendly manner, they can also be used as an insult, and yes, it depends entirely on the intonation and the context.
It’s safe to say pinche gringo is offensive, unless your Mexican friend says it laughing and smiling at you, in which case they’re just having fun.
If they say it angrily, while complaining about something US people do, while actively making fun of them or when complaining about US laws or politicians, chances are they are using gringo insultingly.
As you may have noticed already, gringo being a descriptor rather than a slur means that it’s very hard to come up with a “similar” word.
If you don’t like being called a gringa, tell your Mexican friends not to do it. You’ll be quickly promoted to “güera” instead. (You don’t even have to be blond to be güera, by the way. Sometimes having light skin and light-colored hair is more than enough)
And as for your Latina friend that makes fun of white people who can’t roll their r’s. Well, that’s the topic of an entirely different conversation…