(Note: The question has an incorrect premise. The ideal generated by elements of positive degree in an arbitrary graded ring is not generally maximal.) Let $R=\mathbb{Z}+x\mathbb{Q}[x]$. This is an $\mathbb{N}$-graded ring, where grade-$0$ is $\mathbb{Z}$, and grade-$n$ with $n\geq 1$ is $\mathbb{Q}x^n$. This ring is is not a UFD, since $x=2(2^{-1}x)=2^2(2^{-2}x)=\cdots$ shows that $x$ is infinitely divisibly by the irreducible element $2$. Letting $\mathfrak{m}$ be the ideal generated by all elements of positive grade, then $R_{\mathfrak{m}}\cong \mathbb{Q}[x]$, which is a UFD.