I don't know much about American laws, and I strongly believe that basic housing should not be for-profit.
With those caveats, if a house is empty for such a long time that squatters can claim it (7-20 years according to Google), then I think it's not only okay to claim residence there, I think it's the morally correct thing to do.
Obviously, there are exceptions to anything, but generally speaking, it sounds like society could use more of this.
The 7-20 years you're seeing is probably for adverse posession, which is a step above squatter's rights. If you can show that you've been maintaining the property for that entire time without the landowner stopping you from being there, in some cases you can gain ownership of the property through adverse possession.
Squatter's rights is more about the right to remain where you are as opposed to owning the place. Typically being given similar rights to a tenant.