Yes, it is illegal, you can only purchase items from the store (ranks/perks/items) only and you may not trade ingame items for any other items, including MineCraft accounts as it bypasses MineCraft's EULA.
Sir, sorry but, there is a thread regarding IRL money trade for ingame items. This is basically trading items for IRL money to buy the gift card
Buddy, MC gift codes cannot be withdrawed into real money without 3rd party withdrawl methods. It is NOT trading in-game money for real money.
The reason MC gift codes are legal to buy is because you are buying an unactivated copy of the game, which is not violaton the EULA.
On a side note; why is buying CSGO items or an optifine cape illegal? It does not even violate the EULA in any way, shape or form.
Well, Idk, but I think there is like no chance the server will make money, while with another account, they may