You can have moments like that because they still had moments like>I never thought I'd die fighting side by side with an elf>What about a friend>Aye. I could do that.
And with all sincerity. Their contests their jabs and, yes, I'll say it quips all lead to their growing friendship and overall relationship. LoTR earns the silly moments by not being ashamed of its shmaltzy ones.