This happens in almost every country where prices aren't posted.
The best strategy is not to fall for it. Just say that their price is too high and walk away,,, don't look back or act like you need what they are selling.
They will soon come after you with a much lower price, but hold out for a price that is only a few cents above the local's price.
If they get angry that is their problem and if you come again they won't try to rip you.
The thing to do is to bring a local friend to barter. stay out of the way, preferably out of sight, until the deal has been struck then step up to pay.
The next time this vendor will know that you aware of the real prices and that they can't scam you.
If you pay the high price it is YOU who is loosing face ad respect. Very quickly word will go around that you are an easy mark and you will get high prices from everyone who can.
As to why they do it? It is largely cultural.
It also comes somewhat from foreigners acting like they are above locals. The best thing is to be friendly and never talk down to people. Take a few minutes to chit-chat as best you can even if it is only possible through gestures. If they feel like you have some commonality they will be less likely to try and rip you off.
If you are going to be there for awhile return to the vendors who give you the best prices ad service and pretty soon you will get the local prices, or close to them.