Contest Solution: Remorseful Sam
As long as you are using re.sub() to handle the spaces, you may as well use it to perform the entire task.  Note that I've added entries to codes that maps triple-space to a space, and space to nothing.  Also, since codes contains one entry per line, I prefer to put a comma after every entry, including a superfluous comma after the last one, to make it easy to add or remove entries.

import re

codes = {
    '.-': 'A',
    '-...': 'B',
    '-.-.': 'C',
    …
    '--..': 'Z',
    '   ': ' ',
    ' ': '',
}

with open('morse.in') as f:
    print(
        re.sub(
            '[.-]+|   | ',
            lambda match: codes[match.group()],
            f.read()
        ),
        end=''
    )