Honestly the ending of this movie to me seems to suggest that proletarian martyrdom is a preferable outcome than simply replacing the porky or just giving in to capitalism.
If you interpret the train as capitalism (imo this interpretation is far more complete and meaningful than interpreting the train as the state, or more specifically, the engine as the state) then what Wilfred is doing at the end is simply replacing the capitalist of the enterprise. Giving it to Curtis, so Wilfred ceases being the capitalist but the train continues going as normal. Imagine a scenario where Curtis actually accepts this. It would be an extremely crude ending but it would realistically showcase that the vast majority of people would switch their positions immediately if their class interests changed.
The reason why I think interpreting the train/engine as the state is kind of ineffective is because the train is supposed to represent unsustainability. It won't exist forever and the people that believe and teach this (the teacher in the kindergarten scene for example) are delusional, basically an allegory for capitalist realism. Also, interpreting the train as a state is simply too convenient for what this movie is trying to go for, it basically suggests that by killing Wilfred (proletarians seizing the "state") they can run the train according to their interests. But why would the repressive forces and de facto allied classes of the bourgeoisie allow this? Will the guards and crowd of drug addict lumpens now bow down to Curtiss and his people? No they won't, because by killing Wilfred Curtiss doesn't actually gain anything. He's not in control of anything. This is the opposite situation of workers seizing state power, because "controlling" the train (by killing its "owner") isn't a comparable situation to taking state power.
This is why the train as capitalism interpretation works so much better. Here it actually makes sense that Wilfred is passing ownership of the train to Curtiss, because he's expecting (correctly) that if Curtiss seizes the train, he can only
run it the same way Wilfred has been running it the whole time. If he attempted any radical change the repressive forces of the train and other classes would oust him.
Also this interpretation also works because of the relation between the train, the classes, and the resources in the train. If the train had unlimited resources, there would be no reason to dive the train iPost too long. Click here to view the full text.