usually its better to be riding the mount. but, loose is also powerful.
Riding does a few things:
mainly, it uses the mounts movement to move. so, when you now, get into melee, can do a "Full attack action". if you move then attack, you only attack once. while stationary, lets you do that full attack action, using all your attacks.
at level 5, you probably only have 2 attacks. but, by level 20, and you have 5-6 attacks, its pretty huge. but even 2 attacks is 100% more then 1 attack.
many spells even require that full round.
second, teamwork feats work with mounts. so does flanking. woljif riding a mount, will just automatically have sneak attack due to flanking. yes, just having the pet loose can do this as well, but it works better when they move as one.
third, non-aoe attacks hit the mount first. so you can ignore defense on the rider mostly, and go full defense on the mount. this is a quirk of the game. its not really supposed to work like this.
pets in general are crazy. team work feats, extra bodies/blocking/tanking. their hit rates rarely keep pace with mythic levels, but still. can be a bit of extra damage as well.
pets and mounts can be used for athletic checks as well. how seelah's horse is climbing that rope. I don't know. but it works. this is not automatic. got to select the horse and use it on the check.