Let the amount Ivanna invested in Fund B be \( x \). Then, the total amount invested in both funds is \( 8000 + x \).
The profit from Fund A, which she invested $8000 in at a 2% return, is:
\[ \text{Profit from Fund A} = 8000 \times 0.02 = 160 \]
The profit from Fund B, which she invested \( x \) in at a 6% return, is:
\[ \text{Profit from Fund B} = x \times 0.06 = 0.06x \]
To find the total profit from both funds, we sum the profits from Fund A and Fund B:
\[ \text{Total Profit} = 160 + 0.06x \]
We know that the total profit from both investments is also equivalent to a 5% return on the total investment. Thus, the equation for the total profit at a 5% return is:
\[ \text{Total Profit} = 0.05 \times (8000 + x) \]
Setting the two expressions for total profit equal, we have:
\[ 160 + 0.06x = 0.05(8000 + x) \]
Expanding the right side:
\[ 160 + 0.06x = 400 + 0.05x \]
Next, we will isolate \( x \). First, subtract \( 0.05x \) from both sides:
\[ 160 + 0.06x - 0.05x = 400 \]
This simplifies to:
\[ 160 + 0.01x = 400 \]
Next, subtract 160 from both sides:
\[ 0.01x = 400 - 160 \] \[ 0.01x = 240 \]
Now, divide by 0.01:
\[ x = \frac{240}{0.01} = 24000 \]
Thus, the amount Ivanna invested in Fund B is:
\[ \boxed{24000} \]