  The knapsack problem for groups was introduced by Miasnikov, Nikolaev, and
Ushakov. It is defined for each finitely generated group $G$ and takes as input
group elements $g_1,\ldots,g_n,g\in G$ and asks whether there are
$x_1,\ldots,x_n\ge 0$ with $g_1^{x_1}\cdots g_n^{x_n}=g$. We study the knapsack
problem for wreath products $G\wr H$ of groups $G$ and $H$. Our main result is
a characterization of those wreath products $G\wr H$ for which the knapsack
problem is decidable. The characterization is in terms of decidability
properties of the indiviual factors $G$ and $H$. To this end, we introduce two
decision problems, the intersection knapsack problem and its restriction, the
positive intersection knapsack problem. Moreover, we apply our main result to
$H_3(\mathbb{Z})$, the discrete Heisenberg group, and to Baumslag-Solitar
groups $\mathsf{BS}(1,q)$ for $q\ge 1$. First, we show that the knapsack
problem is undecidable for $G\wr H_3(\mathbb{Z})$ for any $G\ne 1$. This
implies that for $G\ne 1$ and for infinite and virtually nilpotent groups $H$,
the knapsack problem for $G\wr H$ is decidable if and only if $H$ is virtually
abelian and solvability of systems of exponent equations is decidable for $G$.
Second, we show that the knapsack problem is decidable for
$G\wr\mathsf{BS}(1,q)$ if and only if solvability of systems of exponent
equations is decidable for $G$.
