(Note: The original question had an incorrect premise.  The ideal generated by elements of positive degree in an arbitrary graded ring is not generally maximal.)

Here is the solution to the original problem: 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}}$ is the subring of $\mathbb{Q}(x)$ where the constant term of the polynomial in the denominator is nonzero, which is a UFD.  (Up to a unit multiple, every nonzero element is a unique nonnegative power of $x$.)