Question: I asked my Swedish bank to transfer to my UK bank 50,000 euros through a SEPA payment. Unfortunately, the IBAN and BIC were old and no longer in use and the UK bank returned the money the same day, i.e. the transaction failed. The 50,000 euros was put back into my account after conversion to Swedish kronor (SEK).

However, the amount refunded was signficantly less (about 633 euros) owing to a different exchange rate being used for the conversion EUR=>SEK.

Should the Swedish bank not have used the same rate for the refund? In other words, should not the sending of the wrong codes have simply resulted in a reversal or cancellation of the transaction?

Answer: 
What the bank 'should' have done is a question of law, but I will point out that the reason for the rejection was not the bank's error, it was yours / the payee's [which, in the bank's eyes, is still kind of your error].

Consider from the bank's point of view:

(1) You release 50k SEK from your account;

(2) The bank, seeing it is headed to a EUR account, converts it to EUR for you, at their available rate [of course, they will take a cut off of the conversion];

(3) The bank sends the EUR off to the account you requested;

(4) The EUR is rejected due to invalid account;

(5) The bank needs to convert the EUR *back* to SEK for you [again, they do likely take a cut], at a conversion rate that happens to give you 633 less SEK than what you started with.

If the bank did as you ask, and used the same rate to convert your refund in step 5 as your original conversion in step 2, they might have lost money. ie: if the SEK had strengthened in between step 2 & step 5, then it would have cost the bank more EUR, out of their own pocket, to get you your SEK back. They are not a charity, so they chose to charge you the regular conversion rates in both steps.

Whether they *should* do as you ask is probably a question of law; whether they *might* do as you ask is probably a question of customer relationship. That is, if you were worth 633 SEK to them, they might swallow their pride and give you your original value back, if you asked nicely.
The other answers attribute the loss due to changes in conversion rates. For me the change seems to be more due to the [buy/sell rate](https://en.wikipedia.org/wiki/Exchange_rate#Exchange_rate_classification) difference. Every FOREX agency/ bank sets the rates different on purpose so that they make profit on each transacation. I checked a few online websites( transferwise, revolut) and your cheapest conversion fee is approximately 150 Euro for such a large transaction. I assume banks don't do this as cheap as these websites and your one-way conversion fee was indeed around 300 Euro which probably made you a loss of this 633 Euro. Since SEPA transfer in EURO is completely free, this complete fee of 633 Euro was pocketed by your Swedish bank. Depending on how valuable customer you are, they could compensate you somehow although it was your mistake.

In a comment you mention, you need GBP. Then why are you even converting to EURO? Every conversion involves fees and for such huge amount it could easily be another 300 Euro fees when converting to GBP again. Unless this is throw away money for you, **DON'T CONVERT MULTIPLE TIMES!!!** I suggest finding an alternative if your banks don't support SEK->GBP direct conversion.