There is a significant difference between stating that an outcome results from a given action; therefore the given action is just, and stating that a given action is just and noting that the resulting outcome is positive or stating that a given action is unjust and noting that the resulting outcome is negative. To determine the morality or fairness of an action requires us to first examine the action itself. We do not start by finding out whether ultimately a good outcome arose from the initial action, and then proclaiming, "the outcome was good, therefore the initial action was good."
The end does not justify the means; the end is justified by the means.
It is also meaningless to judge the end result in isolation. First, one must judge the means or action that caused the final outcome. If those are just, the end result is necessarily just, regardless of whether one believes the end result to be positive or negative.
Using the end to justify the means relies on a set of false assumptions. You have to assume that you can objectively measure total utility. Utility is subjective and each individual's perception of utility is different. For example: you may believe that security is important but rights are of less importance. You place a high value on security and a low value on rights. I, on the other hand, place a higher value on rights than I do security (I firmly believe that security necessarily results from rights, but that is irrelevant to this example). If we were to ignore justice and focus solely on utility, whose perception would we use? Any attempt to measure total utility would be arbitrary. When we make generalizations such as, "capitalism makes people better off," we are measuring central tendency, but not discounting the possibility that some people may consider themselves better off in a socialist system. The problem with socialism is not just that people are generally poorer, but that it violates the principle of individual rights.
The argument for capitalism does not rest on arbitrary measures of utility, but on the principles of fairness and justice. Any positive or negative results are necessarily just because a system of voluntary exchange free of coercion is just.