The initial ruling may never have been according to several things I've read, it was a preface statement offered by the Chief Justice at the time:
http://www.straightdope.com/columns/read/2469/how-can-a-corporation-be-legally-considered-a-person
Yes. A little history:
First understand that the US in the post-industrial revolution late 19th century had an insane 'pro-business culture'. The ideology, the rulings, the Supreme Court were nuts.
The world had never been through that economy and it took some adjusting, as a popular backlash built up from the early 20th century culminating in FDR.
Anyway, corporations had long fought for more rights as 'persons'; Thomas Jefferson tried to explicitly limit them in the constitution, and it did not pass.
After the 14th amendment was ratified in 1868, corporations began a constant barrage of cases arguing for it to be interpreted to count corporations as people.
They lost in case after case, but had the money to keep pushing the argument - until a case decided in 1886.
Now, why would corporations have gone to great effort on this, beside the benefit?
Because railroad representatives had participated in the drafting of the 14th amendment, and intentionally pressured to have it worded with 'persons', intending for that to be used later for this argument for corporations, unknown to the Congressmen who passed it. However, the word 'persons' had long been used, including in the constitution, to mean only natural persons.
The 14th amendment was explicitly for the interests of former second-class citizens - slaves, mostly black - but there were far MORE cases heard in the courts based on that new amendment of corporations trying to use it than were heard for any actual 'people', black, Americans.
Finally, there was one mysterious, bizarre case. One other thing to realize is that there was an unusual role with the court for its 'reporter' then. It wasn't some typist doing as they're told, really, but a much more powerful position I won't get too much into describing now, but it was a powerful position. Especially telling is that one of the most powerful industries were the railroads; this 'court reporter' was the former head of a railroad; and the case in question involved a railroad.
In this case, the Chief Justice had verbally told the lawyers not to argue the 'personhood' issue, to assume the court agreed in the arguments - but he told the reporter explicitly, and the decision showed, that the court had intentionally not made any ruling on the issue.
This reporter who wasn't on the court made a notation in the 'notes' for the case that wasn't in the ruling, about the verbal comment. But then, unfortunately, in later decisions the court began to rule on that basis with that decision as a 'precedent' of sorts, and it became actual law.
Thom Hartmann wrote a good book on this called 'Unequal Protection'. It actually covers corporate history going back to the world's first major corporation, the East India company started by Queen Elizabeth for the benefit of the nobility in England to profit around the world but not be charged for wrongs.
Looking more closely, there was likely pressure from one of the Justices, who was very closely linked to the railroads, wanting them to pay for his presidential campaigns, who had been pushing the corporatehood claim. He actually sat on both a court of appeals and the Supreme Court, and he'd rule for personhood in cases at the Appeals court that would then be appealed to the Supreme Court where he'd be reversed.
In this case, he wanted the court to rule for personhood, and he wrote a concurring opinion, to agree with the ruling on the tax issue but also complain that the court did not rule on the personhood issue, making his case how now that almost everything important in society was done by corporations, it was important to give them those rights.
The Chief Justice had left it up to the reporter whether to mention the verbal comment, since it wasn't ruled on; it's suspected this other Justice might have pushed for it.
Here's a great excerpt from Hartmann on the history of this:
http://www.thomhartmann.com/blog/2002/01/unequal-protection-theft-human-rights