TITLE: Non-residually-finite finitely-presented sofic group with all finitely generated subgroups Hopfian
QUESTION [7 upvotes]: Is there a finitely presented sofic group which is not residually finite, but all of its finitely generated subgroups are Hopf groups?
It seems like the Baumslag Solitar groups $BS(m,n)$ don't work (i.e. for $|m|=1$ or $|n|=1$ or $|m|=|n|$ they are residually finite, and otherwise they contain a non-Hopf finitely generated subgroup).
Note: Thanks to YCor for pointing out that in the initial formulation I said "subgroups" instead of "finitely generated subgroups". The latter is my intention.

REPLY [8 votes]: Houghton's group $H_3$ (see Section 5.3 here for a definition) is (locally finite)-by-$\mathbf{Z}^2$, which easily implies that all its finitely generated subgroups are Hopfian. (Not all its subgroups are Hopfian: it admits an isomorphic copy of $F^{(\mathbf{N})}$ as a subgroup for every finite group $F$.) It is finitely presented (K. Brown 1987, reference at the above link). It is not residually finite because it has the finitary symmetric group $S_\infty$ as a subgroup. It is amenable hence sofic.

Edit (Jan. 12 '20): the claim that finitely generated (locally finite)-by-$\mathbf{Z}^d$ groups are Hopfian is false, even for $d=1$ (one can construct a counterexample as central extension of a lamplighter group). Therefore I retract my claim that all finitely generated subgroups of $H_3$ are Hopfian; I don't know if it's true. Yet $H_3$ is Hopfian as well as its finite index subgroups, using that the locally finite kernel is virtually simple). 
(As long as this is not fixed the answer should probably be unaccepted.)