According to this site, when either attacking or training a gym,
Energy gained per hit points loss -2 HP = +1 energy
Due to the fact that there is a Same-Type Attack Bonus mechanic in the game that increases damage, one can infer that the higher damage dealt by STAB moves leads to higher energy gains.
Thanks to Eikre's explanation in the comments, my previous answer actually applies to bonus energy being gained from taking extra damage due to the STAB bonus.
Therefore, there does not seem to be a bonus in energy gain for inflicting more damage with STAB moves. In addition, you can see exactly how much energy you would gain for any given attack here.