Don't take it personally, that happens in other countries as well. It's not common, but there are hostels in the US, Canada, and Europe that don't allow people from their own country to stay there. So if it makes you feel any better, there are U.S. hostels that will happily accept you, but not a U.S. citizen. I ran into that once myself when I wanted to stay at a hostel here, so I know it is frustrating.
The reasoning is some hostels are trying to create a particular social environment where you can interact with travelers from all different countries. It's also a way to make sure guests really are people who are traveling, not just locals who need a place to crash, or someone who just arrived in town and is looking for temporary housing. At worse, some hostels that let anyone stay can end up looking more like a housing project or homeless shelter.
It does solve that problem, but it is unfortunate that they also end up excluding people who really are visiting town from other parts of the country. I don't think it's a great policy, but that's the reasoning behind it anyway.