Sealed inner classes

I don’t understand why Msg has to be inner in this code. Please, explain. It seems that it will work just as expected if you just drop inner modifier.