Note: the claim in this answer that $R$ is graded is wrong, I leave it here for the record until popular opinion requests for me to remove it (David Lampert)
Here is a counterexample.
$R=\mathbb{Q}[x,y_1,y_2,y_3,...]/(y_1^2-1-x,y_2^2-y_1,y_3^2-y_2,...).$
There is an embedding $R \subset \mathbb{Q}[[x]]$ defined by power series expansions which gives $R$ a grading with $m=(x,y_1-1,y_2-1,y_3-1,...).$ Note: this is wrong, see commments below.
$R$ is not a UFD: there is no irreducible element dividing the non-unit $y_1$.
$R_m$ is a UFD: (1) Every non-unit is a product of irreducibles since each $y_n$ is a unit in $R_m$; (2) If an irreducible divides a product then it does so in some $\mathbb{Q}[y_n, y_n^{-1}]$ which is a UFD.