What are some way to give praise to a professor without resorting to flattery? In elementary school we are taught to give an apple to your teacher as a sign of appreciation. Obviously it doesn't work anymore in academia.

I wish to maintain a relationship with a professor after his class, so to establish a relationship that maybe worthwhile longer down the road.

What are some of the ways to show appreciation to your university prof. without resorting to excessive (and often empty) flattery or sending him gifts which maybe in violation of university policy and land everyone in trouble.
After I finished my undergraduate degree I wanted to thank those professors who were the most influential to me and my studies over the past years.  In particular, those who wrote all my graduate school letters of recommendations and took the time to help me through the process.  I thought about getting them a gift, but felt it was inappropriate.  

What I ended up doing was typing a letter to them which thanked them for all they did to me and provided a specific example in which they were influential to me that helped steer me in the direction I was going.  I then mailed it to the department so they received it unexpectedly.  All of them emailed me to thank me for the nice letter and that it was their pleasure.

This would be a really nice thing to do that isn't flattering and full of praise, but what you actually got from them that was beneficial.  

Hope this helps :)