Is it appropriate to give a gift to a teaching assistant for helping outside of work time? I am thinking of buying a small gift, like coffee, for a teaching assistant, who helped me solve problems in a particular subject, even outside of work time, to thank for the effort. 
Is this appropriate or even allowed?
I would consider that, in many cases, helping students "outside of work time" is often still under the normal job description of a teaching assistant. However, since you are asking the question, I am going to assume that your TA went above and beyond their normal calling. Even in that case, a gift might make someone uncomfortable, and should certainly never be given before grades are final.

Other options that might achieve what you want without making anyone uncomfortable and that might have greater impact with no more effort from you than a gift could include:


Nomination for a teaching award. Many institutions have some formal mechanism for recognizing great teaching assistants; even a nomination could be something that TA could use in the future on a job application.
Letting the professor know how helpful your TA was. Professors don't see all aspects of their TA's work. Knowing that a particular TA was helpful to the students might help that TA get a future position, or is material that can be included a letter of recommendation. You could also ask the professor if there is anyone else in the department where you can send compliments for a particular TA.


There is also nothing wrong with thanking your TA directly and making it clear their time was appreciated - no need to go overboard, just a simple email is sufficient.