The two legs cancel the exchange rate risk and leave only the interest difference. Buy euros for spot and sell them for one month, and you have effectively borrowed dollars for a month using euros as collateral. That is why the FX swap market, not the loan market, is where much short-term global funding actually happens.
A one-day version of the same structure, tom-next, is what keeps retail positions alive overnight.
Example: a bank needing dollars for a week sells EUR 50,000,000 spot at 1.0840 and buys them back one week forward at 1.0845. It receives $54,200,000 now, returns $54,225,000 in a week, an implied cost of about 2.4% annualised on the dollars.
Related: tom-next, currency-swap, cross-currency-basis