As $k\subseteq l$ is a purely inseparable extension, characteristic of $k$ should be positive, say $p$. The only fields I know with positive characteristic are finite fields and $F(T_1,\cdots,T_n)$ (where $F$ is a field with positive characteristic like finite fields).
I started to make an example.
Let $K=F_{p^n}[T]$ and $L=F_{p^m}[T]$, $n$ x) then $A[x]=B$).
Now if $A$ be trivial then since $T,T^{-1}\in A\subseteq B$, $B$ should be trivial which we said it is not the case.
Can we guess this result is global, I mean the answer of the main question should be "The necessary and sufficient condition is $y\in A[x]$"?
If we change the question in this form that instead of the residue fields, $K\subseteq L$ is a purely extension then except the above example we have another class of examples with the same result. We can get $K=F_{p^n},L=F_{p^m}$, $n
Again can we say answer in the new case is "The necessary and sufficient condition is $y\in A[x]$"?
Here at least I gave an answer in a class of examples.