Maine used to have a law that disallowed welfare recipients from voting. If you ‘lived off the town’, you could not vote.
IIRC that lasted until the 1930s.
It’s allowed under the US Constitution IMO.