EDIT I think the answer of @user12075 above is correct, that is, the pull-out force on the top screw is the same whether the shelf is
installed with the longer vertical segment on top or the shorter
vertical segment on top. The two lengths appear in the formula only
as the sum, so if the two values are interchanged the result is the
same. And that sum is in the denominator so the pull-out force is
inversely proportional to the sum of the two.
EDIT To explain my retraction of my original claim that that the longer vertical segment should be on top and my agreement with @user12075, one can use the intersection of the two parts of the Tee as the origin for calculating the three moments. That way each force of interest is perpendicular to its radius arm and so no trig is required.
Put the long side (4") on top. This gives a smaller pull-out force on the top screw than having the short side (2") on top.
Without doing calculations you can visualize how much the pull out force increases as the length of the top side would decrease toward zero. We all know that when using claw hammer to pull out a nail in a vertical wall by pulling down, it is easier as we get the nail deeper into the V of the claw. This means the pull-out force increases as the top side get shorter.
EDIT
I have to admit to being guilty of using vague intuition to answer the question, but I think there is no actual physical fulcrum at the position of the bottom screw. For example, if the vertical member is in uniform contact with the wall, then the wall is exerting force on the bracket all along its length.
One can modify the problem by doing away with the bottom screw. (The ELFA hanging shelves, standard installation has no bottom screw. ) Then all vertical force exerted on the bracket by the wall is exerted at the position of the top screw.
One can idealize the problem where the vertical member is in contact with the wall only at two points: the top screw and at the position of the bottom screw (which may or may not have a screw in it).
I installed a lot of ELFA hanging shelves in two houses which motivated me to do some figuring on the forces, but I have lost my calculations. I will see if I can redo it, but it would take a couple of hours of concentrated effort and I have a lot of distractions right now.