Yeah, it's a formula, it depends on the number of racers online, the position you finished in, how close your time is to the top time, if you crashed or not (10% more of what you'd get if you don't), in the winstreaks you may have, and probably something else i'm forgetting.
Gary got more score because he probably didn't crash and you did (he would have got 9.13 if he would have crashed)