How can I tell if an HO train car...box....tanker....flatbed...ext. is a good one, worth using in a permanent layout, or just a cheap one that won't last to long.
That is actually a very difficult question, because there are toys, there are good runners, and there are good lookers. Some of the cheapo toys will actually last longer under heavy use than the good lookers. I am getting the impression you are wanting the good runners. Also assuming you are talking USA.
Talking new in box stuff: for the good lookers you can definitely go by price. $59 would be a very high end freight car. It will be very detailed and run very well. The problem is you have to handle them gingerly. The fine details will bend and break off with the slightest bump. I stopped using these type of cars when I run the trains at show and operating sessions because invariable something happens. Brands are Intermountain, Scale Trains, Bluford Shops, probably Broadway Limited.
For average good runners the price has been climbing so I would look for name brands instead. Athearn is a hobby standard. There is also Roundhouse, Bowser, Atlas, Accurail, and Walthers. I would recommend you focus here.
The cheapo toy stuff is brands like Life-Like, Bachmann*, Model Power.
*Bachmann makes several lines of stuff, they have a Spectrum line that is top notch, and a "Silver" line that is so so.
The used market is much harder to navigate. Lots of toy stuff is going for high prices on eBay so one cannot use price as a guide here. Look for metal wheels, look for metal hooks that look like a hand not a curved plastic, look for hooks that are mounted to the body of the car and don't pivot with the wheels. Brands to avoid would be Tyco, IHC, Industrial, Marx.
So many more brands it is hard to list and categorize them. Also as Santa Fe Willie said almost anything can be worked into something that is nice looking and runs well, it just depends how much time, effort, and money one wishes to exert. I stopped taking on "project" pieces, just because my backlog is already so huge. I just pay more for what I want "now" without the extra work part.
Also, same question for HO train engines. I now there are different engines for different types of cars.
Yes, locomotive identification is a topic that one could write books on. Also makes a big difference if one is talking about Steam, Diesel, or Electric. In general a short diesel with a big cab will be a switch locomotive. For steam a switch engine will be one with only a few driving wheels. For diesels passenger locomotives are going to tend to be longer and more graceful looking while freighters are either shorter or utilitarian looking.
Passenger locomotives



Freighters



