# Categorical Variables in Random Forests

I am aware that categorical variables should be one hot encoded before modeling with random Forests. But I am not entirely sure why.

Lets say we have a predictor categorical variable with 7 levels. The tree should be able to find similarities/differences within this variable if it is numerically encoded. Why do we have to one hot encode categorical variables?

How can I simulate a regression to showcase the difference?

The problem is the decision tree construction within the random forest. When constructing a DT one selects for all (numeric) attributes all possible (actually seen) values $$x$$ of that attribute such that making the decision
$$value < x$$
$$value \in subset$$