I ran across a real world example of this tonight on my commute home from work. It's got nothing to do with software, but I think it fits nicely in with the conversation.
There is a major college in my metro area that has trademarked the words "Sun Devil". You may have heard of them. Anyway, many companies around here use "Sun Devil" in their names, for example Sun Devil Auto, Sun Devil Manufacturing, Sun Devil DVD...you get the idea. Whenever I come across another "Sun Devil" business, I think "Man, can't you be more creative?" They are obviously playing off of the popularity of the college and especially the sports teams to drive business.
Well, one of these companies has decided it would be a good idea to name a beer after the college, I believe it's called Sun Devil Ale. Apparently the college is upset about this and has threatened to sue the company producing the beer because it infringes on their trademark...but no one else is even though (from what I understand) all these other companies have not asked for permission. The college can be selective (as is it's right) on who it does or does not allow to ride on it's coat tails, so to speak.
So where does this leave us? It's ok to use the work of others and modify them for your own purposes for your own benefit, even in trademark land. However, if you're going to use it, it's probably best to ask first. Just like the borrowing of $50 discussion. There's a big difference between asking to borrow $50 and stealing $50.