Older fantasy novel about a poor boy who goes into a magical rich city
This is a fantasy novel I read in the 90's. All I can remember is the MC was a boy who (as I recall) is abandoned (I think his guardian dies or disappears). He ends up going into the city of the wealthy (he may have been warned not to go there), and which may have been on top of a mountain or similar remote location. The main scene I recall was he goes into a shop and sees everyone just taking what they want and walks out, so he does that too. What he doesn't know is they are magically tagged, so the cost is charged automatically but as he isn't tagged, the alarms go off, so he is caught. I think he is then adopted by someone in the city to be raised. There may have been a plot twist where he was originally from the city, but I don't really recall.