Agree with adrian89987, alkaloids are called as such because they have alkaline (basic) properties. And this is because they contain nitrogen atoms, which, in organic chemistry can act as bases. Alkaloids are very weak bases and according to dissociation equilibria they are going to provide OH- only when there are sooo little OH- in water (i.e. under acidic conditions).
As an example, if one considers one of DMT's nitrogens (let's take the one with the two methyls attached) its behaviour in solution is going to be:
N + H2O <-> NH+ + OH-
In a very basic solution (pH>10) there are plenty of OH- around and the reaction will be shifted towards the left hand, giving you non-ionized nitrogen. So, you have the freebase form in basic solutions
In acidic solutions (pH<5) OH- concentration is very low and DMT's nitrogen feels the need to supply some OH- to the solution, so the reaction is shifted to the right. By doing that however, your nitrogen is ionized (it gets a positive charge!) In this state it can associate with the negative ions of the acid that made the acidic solution (be it HCl, citric acid, carbonic acid etc) to give you the respective salt form. It is the exact same thing with almost all the rest alkaloids.
Hope that makes sense