If the cable companies used to do this, then why do they pay royalties to the networks nowadays?
Because the television stations sued them and won on the basis that the cable companies were essentially offering a public performance of the television broadcast because they had one antenna and transmitted the input to many users.
Why is Aereo getting sued if they're doing the same thing the cable companies can do?
Cable companies can do it currently because they license the content from the providers (i.e. they pay for the priviledge). Aereo is trying to get around paying the content providers by providing every subscriber with her own personal antenna and saying it's not a public performance. We're just automating what the subscribers could do themselves by erecting their own antenna, attaching it to a tuner and a dvr, and putting the DVR on the internet.