There is a difference between being a friend and being an easy mark.
For the most part, people expect their friendships to be reciprocal. It is perfectly normal to do a favor or pay for something for a friend, but there is usually an informal agreement that they may do the same for you further down the line. Like all relationships, having friendships requires you to put in the work. That will probably mean taking out your credit card occasionally.
That being said, it can prove important to be prudent when it comes to covering expenses in this area of life. Some people are more than happy to take advantage of somebody’s generosity and expect them to bankroll them in ways that were never agreed on previously. They see the relationships in their life by how much value they can extract from them, and not how they can balance the give and take in a way that benefits the lives of both parties. If they think that they have the money to spare, they will make a point of using it for their benefit. They feel entitled to that by virtue of being friends with somebody on a higher income.