Why are grade 5 raw mats listed as grade 4 in the raw mat trader? Because they are clearly listed in the inventory as grade 5. (until Fdev goes and makes the 5's 4's of course.)
Raw mats were royally screwed by 3.0. The devs haven't disclosed their reasoning for doing so, but this is what is the history behind it from what I can tell:
1. The devs wanted to completely revamp raw mats in 3.0. Why? No one knows. But this included changing the rarities of mats, and a redesign of the algorithm that decides the mat composition of planets, which would include changing the composition of planets already discovered. I'm guessing these changes were all tied together with one big underlying redesign of the way raw mats were going to work. The raw material trader was made with this new system in mind.
2. During beta players were not happy about the fact that the devs were changing the composition of planets that we had gone to extreme lengths to map out, so the devs pulled that part of the changes after listening to player feedback.
3. With the changes to mat spawning removed, the changes to the way rarity worked didn't make much sense. But instead of just cutting their losses, they doubled down and kept the raw material trader and started changing the rarities of mats to correspond.
Oh and they didn't change the recipes the mats were used in so some "g4" mats are used in lower grade versions o a blueprint than "g3" mats.
I'm not going to go into more detail because at this point I've written so much about what's wrong with this game I'm getting close to a small book and I've just about had it with fdevs counter-intuitive nonsense.