Did you get a formal invitation and send in your reply? Then you really need to follow through. Your friend has paid for your meal with the caterer, and done seating arrangements. If you change now, you cost her money and create headaches. Two weeks to go is just not a good time to be backing out under any circumstances, short of a terrible emergency like serious illness or a death in the family.
If it's a casual wedding with a cake and champagne reception in the church hall, then you MAY be able to decline by saying something urgent came up and you are devastated not to share her daughter's special day with her. But it's going to have an impact on your friendship for sure because it will be obvious that you just changed your mind. There's no really nice way to say "It's just not worth it to me to come."
I don't understand what happened with the logistics - did you not realize how far the wedding was when you were invited? I'm not sure how you can explain this lack of planning to your friend without sounding superficial. Can you find an inexpensive, no-frills hotel through AAA (if you are a member) or through one of the on-line search services like Hotwire or Priceline? They have so many last-minute deals and you can determine how many "stars" the hotel has and go for something low-end. You won't be there long at all - you'll be at the wedding. Perhaps you can get a small fridge in the room and take your own food for dinner and breakfast? That's if it's for the night before. If it's for the night after the wedding, your dinner will be handled at the wedding, and you can have a good night's sleep and take the drive the next day.
You are not obligated to send a gift at the time of the wedding - you can send it a month or so later. Perhaps you can use your funds now for the motel, and then next month send a gift when you've had another paycheck. Please don't take a gift to the wedding anyway - it's a huge imposition for the family, and it's a security issue (a lot of people crash weddings to steal gifts and envelopes of cash). So sending it afterwards is more than okay. And the gift should go to the bride & groom, while the RSVP goes to the host who issued the invitations (in this case, your friend.)