OK, so there's all sorts of different reasons for hiring contractors... and some of the answers to the social questions are - it depends.
Here's a few examples of why you hire contractors:
The company needs "temporary labor" - this fits well with the legal and tax ramifications of contractor employment - they are taxed different and regulated as employees differently partly because they usually start the job with expectation of there being a near-term end date that may even be highly flexible. As such, they are easier to fire, but also it's important that they not end up drawing the conclusion that their jobs are just as secure as a regular employee. A contractor can be given the same tools, office space, and responsibility as a regular employee, but then it has to be very clear that his job is for a finite time (because he helping with a "crunch") and there are usually limits to how long he can be working there before you either have to permanently hire him or let him go.
The company likes to try before they buy - let's face it - it's really hard to pick great people, and it's really hard to get rid of people who are permanent employees. Contractors are much easier. So it makes a great deal of sense in some places to take on a contractor, try out their work, and make a permanent offer. It can be well worth any recruiter/contract agency fees for the reduction in lame-employee risk.
The company has a specialized need - some new project or initiative requires skills not normally in the company's talent pool. A contractor and/or consultant comes in for a span of time to help with the hard stuff and train employees in the day to day stuff. The idea is that when their skills are either learned by regular employees or no longer needed, they will leave the company.
Sometimes the duration is long term, sometimes it's short term. For example, I worked with a consultant who had worked with the company for years. As legislation has evolved, he's evolved, and he does not work full time with the company, but adjusts his schedule to be there when his client needs him, and he does other gigs at other times. Other contractors I've worked with have been just like a regular employee- but for a short busy season.
The trick is - there IS a separation. In some companies the vibe can be such that you invite EVERYONE out for these very informal occasions, since there is no company money being spent and it's totally voluntary. At other points, management may be particularly concerned about raising the expectation with contractors that they are a permanent part of the team. For example, if you expect that Bullet #2 is the situation, then the manager may not want to raise the expectation with the contractor that he will definitely get that permanent offer - and informal invites can set exactly that expectation.
Also - if the contractor is really there in a consultant capacity, his donation to something like a babyshower can be seen (by an outside observer... like a jury) as a payoff. Yes, in most cases, it ISN'T a pay-off, it's just that the team is passing an envelope, but it can be a very fine line.
Lastly - contractors, by and large, are NOT permanent employees. Do they WANT the invite, especially if the context is that they have to accept or be rude? They aren't building the same long-term bonds that permanent employees may build.
So... backing up to the questions:
Business Gains -
The clear separation hopefully makes it clear to both contractors and employees that the roles are not the same. In a very subtle way, this hopefully makes employees realize that contractors won't be around forever in most cases, so they should be worked with and appreciated when they are there. I frequently tell folks that work with me that if you aren't learning as much as you can from the outside expert while he's around, you aren't doing yourself or the company the most good. So perhaps this gain is "a subtle efficiency improvement".
Probably the one most bosses, HR reps, and lawyers think of first - law suits (yeah, sigh, this is US-specific). The cost of a lawsuit is huge to everyone - and in fact management can be sued for making a wrong decision here. Especially if they act out of sync with HR and legal guidance. So it can be both a personal/professional disaster as well a big corporate cost in lawyer fees if not benefit payouts. To say nothing of the morale hit if such a thing happens.
There's also a subtle efficiency cost when management and employees forget that contractors are contractors. When anyone in a company ends up making the long-term decisions for that company, without the onus of a reasonable expection of being around to see the outcome of those decisions, then you probably don't have the right decision maker doing the work. If everyone sees the contractor as "one of the guys" and the guy disappears - will everyone suddently look up and realize that he was the guy who made most of the decisions and no one can figure out why those decisions were made? These can often be really expensive mistakes.
The Other Side
Going a bit beyond the question - there is another side to this. Feeling like more than a part of a machine and knowing that you are appreciated for being more than just a set of hands doing a job is key to motivation for most people. So there IS a cost to totally leaving the contractor out of the loop of the day-to-day, low impact social occasions in a thriving team. No one wants to be the guy in the corner and eliminating the contractor from those events can do that. Not to mention that other employees (being nice people) tend to feel not-so-great about leaving out a decent guy from the social stuff - just about everyone has felt like an outcast, and no one really wants to do that (knowingly) to someone else. The impact is not easy to measure, but I'd say an exceedingly rigorous enforcement of separation is likely to have it's own efficiency cost on some level.
So... most managers walk a tightrope. A good boss and a good contractor can work it out - for example, I've done the following:
Sent out team-wide invites to social occasions making it every clear that it was social, not paid time (for anyone!) and that there will be no onus on not going. When it comes from management, it can be a little easier to lay down the law on expectations. I often only have to set the tone once or twice with a new contractor, and then the expectation is self perpetuating
Give a contractor charge code for true team building - so long as the team building is about the work at hand, and not longer term strategy planning. Do it consistently - don't play favorite-contractor - it's all or nothing.
Do the "contribution requested" type things in such a way that the contractor can anonymously contribute in a way that I don't know about (as the hiring manager) and make it so that ANYONE can sign the card, contribution or not. This often means asking an admin or a socially ept team member to take point person, and doing some minor micromanagement (don't keep a list with how much each person gave!).
Spend a lot of time asking myself = "if I had to explain my rationale to 12 random people who don't know me at all... would this make sense and would it be clear that I acted honorably? Is there even a slight chance that I might seem to be sleazy?" I often run the strategy for each case by others in my management team, figuring if they can't see a problem, we're probably good.
Conversely, I've had contractors check in with me. I was lucky to have a fabulous contractor early in my management career who had a great way of phrasing questions - I could tell, simply by how he asked the question, whether he actually wanted to be part of the party, or whether he was asking me because he didn't want to disapoint his employer. Having a contractor who is obviously clear on the fact that social occasions are meant to be easy going and build camraderie is a great boon.