Many (all?) states award attorneys fees as a matter of law for specific claims. In my state, most of our tenent protection laws award tenents attorneys fees automatically if they win (along with triple damages).
Private contracts also frequently include a loser pays provision.
Additionally courts can, under their own authority, award attorneys fees if one sides does something to drag out and increase the cost of litigation; which is almost certainly how this dispute got so expensive.