When is it true that $f(x)\int_{U} g(y) dy \le \int_U f(y) g(y) dy$ for a.e. $x \in U$ ($f$ not a constant)? Let $U$ be a bounded smooth open subset of $\mathbb{R}^n$ and $f,g: U \to \mathbb{R}^+$ be integrable (non-constant) functions. 

Under what additional assumptions on $f$ (or on $f$ and $g$) do we have that
  $$f(x)\int_{U} g(y) \, dy \le \int_U f(y) g(y) \, dy $$
  for a.e. $x \in U$?


Clearly the statement holds true if $f$ is constant. Are there more general conditions on $f$ that allow us to ''bring the product out of the integral'' as above?
Maybe if $f(x)$ is of power-type?
 A: Let $L_f$ be the set of all Lebesgue points of $f$ for which the inequality from the start post holds. This set has full measure.
For all $x,x'\in L_f$ we have
$$
f(x)=\lim_{R\to 0}\frac 1{|B_R(x)|}\int_{B_R(x)} f(y)\,dy=\lim_{R\to 0}\frac{\int f(y) 1_{B_R(x)}\,dy}{\int 1_{B_R(x)}\,dy}\geq f(x').
$$
Changing the roles of $x$ and $x'$ we arrive at $f(x)=f(x')$. In other words, this inequality can never hold for a "truly non-constant" function $f$.
If you are not familiar with lebesgue points, here is another proof: By assumption,
$$
\|f\|_\infty\leq \int_U f(y)g(y)\,dy\leq \|f\|_\infty
$$
for all (non-constant) integrable $g\colon U\to [0,\infty)$ with $\|g\|_1=1$ . For $c<\|f\|_\infty$ let $g=1_{\{f\leq c\}}$. Then
$$
\|f\|_\infty |\{f\leq c\}|\leq \int_{\{f\leq c\}}f(y)\,dy\leq c|\{f\leq c\}|,
$$
which implies $|\{f\leq c\}|=0$. Thus $\{x\in U:f(x)=\|f\|_\infty\}$ has full measure. This proof has the advantage that it works for all measure spaces and does not use the structure of $\mathbb{R}^n$ too much.
The last proof can be strengthened as follows: If $\|f\|_\infty\|g\|_1\leq \int f(y)g(y)\,dy$, then $f$ is a.e. constant on the support of $g$. The proof is essentially the same. If $\{f\leq c\}\cap \operatorname{supp}g$ has positive measure for some $c<\|f\|_\infty$, then
$$
\int f(y)g(y)\,dy\leq c\int_{\{f\leq c\}}g(y)\,dy+\|f\|_\infty\int_{\{f>c\}}g(y)\,dy<\|f\|_\infty\|g\|_1.
$$
Thus, if you want your inequality to hold for some non-constant function $f$, you need to restrict to a class of functions $g$ that are all supported in some fixed proper subset of $U$. In this case the behavior of $f$ outside this subset of course does not matter, but it will still be constant a.e. on this subset.
