The title of your quesiton asks for the penalty range for possession of a controlled substance PG2 4- 400 grams so I will answer this first. But you also ask about a state jail offense. There is a huge difference in these two charges. Was your friend arrested with a state jail for his alleged sale of under one gram to a friend, then subsequently charged with the 4-400 grams when he was searched incident to arrest? If so, he is likely looking at prosecution on the higher quantity, not the state jail quantity.
The penalty range for possession of a controlled substance PG2 4-400 grams is 2nd degree. The penalty range for a 2nd degree felony is 2 -20 yrs Tx Dept Criminal Justice and a fine up to $10,000. But a quantity of 4 grams or more could be indicted as a dealer quantity. In other words, the prosecutor could ask the grand jury to indict as PCS with Intent to Deliver 4-400 grams. This bumps the penalty to a 1st degree felony, with a range of punishment of 5 - 99 yrs/Life and a fine up to $10,000.
It sounds like the marihuana charge in Fort Worth is a felony conviction. If so, your friend is not eligible for probation and this current charge could be enhanced with the conviction. Thus, the 2nd degree PCS 4-400 could be bumped up to 1st degree.
Possession under one gram is a state jail felony. Did the police detain the person who gave the $5? Did they find the drug on him that your friend allegedly sold him? Is your friend charged with selling under one gram to that person? If that is all he is charged with, this is a state jail offense. The range of punishment for state jail in 6 months - 2 yrs State Jail and a fine up to $10,000.
Would it be worth the money to fight it? The information you have provided indicate Fourth Amendment issues may be triggered, but a lawyer needs to review the details of the offense before your friend can make an informed decision.