I think even 大辞林 treats them as synonyms. If I had to force a distinction based on the order of the kanji, I would say 材木 is wood that is suitable for use as construction material, whereas 木材 is material that is wooden. What comes before modifies what comes after, and thus, what comes after is usually the ‘main character’. That’s a general rule of how kanji work in Mandarin and in Japanese.
I know this is a meme thread, but seriously speaking, 栄光 has to be glory, while 光栄 is far more likely to be honour. It’s in the kanji, and you just need to apply the same rule: what comes before modifies what comes after, and the second kanji is the main noun. 栄 on its own (in both Japanese and Chinese, I believe) refers to ‘honour’, ‘good repute’ and ‘fame’, and can of course also be linked to ‘glory’. However, it’s basically some sort of thing that allows its possessor to hold his/her head up high. As such, 栄光 is an ‘honourable light’, and well, only glory carries that sort of radiance. On the other hand, a ‘shining good reputation’ (光栄) is honourable above all, and not necessarily glorious.
Here’s an old post in which I did a full analysis to differentiate them.