$\newcommand{\R}{\mathbb{R}} \newcommand{\vpi}{\varphi}$ The answer is: the condition >$E(f(X,Y)|Y)=\vpi(Y)$ for all $f$ such that $f(X,Y)$ has a finite expectation holds iff $X$ and $Y$ are independent. Indeed, if $X$ and $Y$ are independent, then for each Borel subset $B$ of $\R$ \begin{align*} EI\{Y\in B\}\vpi(Y)&=\int P(Y\in dy)I\{y\in B\}\vpi(y) \\ &=\int P(Y\in dy)I\{y\in B\}Ef(X,y) \\ &=\int P(Y\in dy)I\{y\in B\}\int P(X\in dx)f(x,y) \\ &=\int P(X\in dx,Y\in dy)I\{y\in B\}f(x,y) \\ &=EI\{Y\in B\}f(X,Y), \end{align*} where $I$ is the indicator. So, $E(f(X,Y)|Y)=\vpi(Y)$. Vice versa, suppose that $E(f(X,Y)|Y)=\vpi(Y)$ for all $f$ such that $f(X,Y)$ has a finite expectation. Take any Borel subsets $A$ and $B$ of $\R$, and let $f(x,y):=I\{x\in A\}I\{y\in B\}$ for all real $x,y$. Then for each $y\in\R$ \begin{equation} \vpi(y)=Ef(X,y)=EI\{X\in A\}I\{y\in B\}=P(X\in A)I\{y\in B\} \end{equation} and \begin{align*} P(X\in A)P(Y\in B)&=EP(X\in A)I\{Y\in B\} \\ &=EI\{Y\in B\}\vpi(Y) \\ &=EI\{Y\in B\}f(X,Y) \\ &=EI\{X\in A\}I\{Y\in B\}=P(X\in A,Y\in B), \end{align*} so that $P(X\in A,Y\in B)=P(X\in A)P(Y\in B)$.