Either that, or Lugnut accepted Starscream's offer with a rationalisation loophole.

That being that Starscream ultimately serves Megatron, because Megatron is the leader of the Decepticons.

Lugnut will likely have been repaired by Starscream and feign loyalty. All he needs to do is swear allegiance to the rightful commander of the Decepticon cause - Starscream, believing Lugnut to be referring to him would fall for that one easily, given his massive ego.