Here is a counterexample. Consider the function
$$
f(x) = \sum_{n\ge 2} \bigg(\frac1{\ln n} - \frac{1}{ \ln |\ln |x - n||}\bigg)\mathbf 1_{[n-e^{-n},n+e^{-n}]}(x),
$$
where $1/\ln |\ln 0| := 0$. It is straightforward to check that this function is non-negative and uniformly continuous: its modulus of continuity is
$\omega(h) = \frac{1}{\ln |\ln h|},h\in [0,e^{-2}]$.
Further, for any $a>0$
$$
\int_{\mathbb R} f(x) |x|^a dx \le \sum_{n\ge 2} \int_{n-e^{-n}}^{n+e^{-n}}\frac{|x|^a dx}{\ln n} \le 4\sum_{n\ge 2} \frac{n^a}{e^n \ln n} <\infty.
$$
However, for any $a>0$,
$$
f(n) n^a = \frac{n^a}{\ln n} \to \infty, n\to\infty.
$$
Some intuition behind the example.
We wish to take some function $g$ which rapidly decreases to zero from its maximum in zero and then replicate it along the real line (taking the very same function is important in view of the uniform continuity requirement), i.e. to consider $g(x-a_n)$ with $a_n\to \infty$. We also need to lower the replicas down to zero (so that the integral is finite), i.e., to consider $\big(g(x - a_n) - g(0) + b_n\big)^+$ with $b_n$ decreasing to $0$ from above, but not too fast, since we need $f(x)|x|^a$ to be unbounded.
For $a_n$, the simplest is to take $a_n = n$; after that it's a matter of choosing $g$, which should decrease from its maximum much faster than any power (in my example, $g(x) = (1 - 1/\ln|\ln x|)^+ )$, and $b_n$, which should decrease slower than any power (in my example, $b_n = 1/\ln n$).