Here's one way.
Start by applying your arithmetic function to each row while retaining the group label:
{#[[1]], #[[2]]*#[[3]] + #[[4]]} & /@ data
(* {{"g1", 31}, {"g1", 58}, {"g1", 63}, {"g2", 60}, {"g2", 32}, {"g2", 65}, {"g3", 27}, {"g3", 30}, {"g3", 30}} *)
Now group by the first item, the label:
GroupBy[{#[[1]], #[[2]]*#[[3]] + #[[4]]} & /@ data, First -> Rest]
(* <|"g1" -> {{31}, {58}, {63}}, "g2" -> {{60}, {32}, {65}}, "g3" -> {{27}, {30}, {30}}|> *)
Now tack on a sum calculation with Total:
Total[#, 2] & /@ GroupBy[{#[[1]], #[[2]]*#[[3]] + #[[4]]} & /@ data, First -> Rest]
(* <|"g1" -> 152, "g2" -> 157, "g3" -> 87|> *)