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: 
Most likely this will be an expensive lesson to learn. However, I believe there still is a chance to recover some of the difference, since your wording of "*my* Swedish bank" and "*my* UK bank" implies you have a relationship with both banks.

If your Swedish bank converted the funds to Euros first, and then attempted the transfer, then your Swedish bank made a profit when converting it back. If the UK bank received SEK and did the conversion, then the UK bank made a profit by not returning the full amount. Either way, you may ask the bank that profited off of you if they would be willing to make you whole again. If it's the UK bank that needs to do it, I'd guess they would be more willing upon receiving the transfer again properly.

Good luck, and please let us know if you do end up getting some or all of it refunded.
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.