Meta earnings hit by legal penalties amid AI race