Let me describe a situation where your statement is true.

Let $X \subset \mathbb{P}^n$ be any smooth, *projectively normal* subvariety of the projective space and let $C(X)$ be the projecting cone over $X$, with vertex the point $p$. Then $C(X)$ is factorial (i.e. the coordinate ring of $C(X)$ is a UFD) if and only if the following condition holds:

**(1)** every irreducible codimension one subvariety of $X$ is cut out (scheme theoretically) by a hypersurface of the ambient space.

Since the localization of a noetherian UFD is still a UFD, this implies that if **(1)** holds then $C(X)$ is also locally factorial, i.e. the local ring at the vertex $\mathscr{O}_{X, p}$ is a UFD. Notice that the local rings at the smooth points are automatically UFDs, since they are regular local rings (Auslander-Buchsbaum theorem).

Condition **(1)** is satisfied in the following cases:

**(1a)** $X \subset \mathbb{P}^3$ is very general surface of degree $d \geq 4$ (Noether-Lefschetz theorem);

**(1b)** $X \subset \mathbb{P}^n$ is a smooth, complete intersection with $\dim X \geq 3$ (Lefschetz theorem on hyperplane sections);

**(1c)** $X$ is a Grassmannian embedded by the Plucker embedding.

One can also ask when $C(X)$ is *analitically locally factorial*, i.e. when the *complete* ring $\widehat{\mathscr{O}}_{X, p}$ is a UFD. By a theorem of Mori, this condition implies local factoriality, but in general the converse is not true. If **(1)** holds, a sufficient condition for analytic local factoriality is the following:

**(2)** $H^1(X, \mathscr{O}_X(n))=0$ for all $ n >0$.

Condition **(2)** is satisfied, for instance, when $X$ is a complete intersection and $\dim X \geq 2$.

For further details you can look at Lipman's paper *Unique factorization in complete local rings*, in Algebraic geometry (Proc. Sympos. Pure Math., Vol. 29, Humboldt State Univ., Arcata, Calif., 1974), pp. 531–546. Amer. Math. Soc., Providence, R.I., 1975.
The paper is freely available on the web.