Because they have a monopoly and can enforce it with violence. If you go with the competition (e.g. register your cars in Arizona, or overtly try to live off an out of state ID while being a resident) they will fine you and if you don't pay the fines they will send guys with guns to put you in a steel cage. Sure you can forgo the DMV's primary service if you're lucky enough to live in one of the few areas where public transit is a reasonable option but you still all but need an official ID for day to day life and the DMV is where you get it from.
Without fear of competition entities (be they states, cities, corporation, your local church or even a street gang) feel free to do things to increase revenue extraction at the expense of the people they are supposed to be serving.