I'm sorry for your trouble but I don't think you can get mad because you were caught breaking multiple laws. As far as the pills, you were caught smuggling controlled substances that aren't in your name - that's against the law and it's against the law entering the US as well. You were also caught smuggling a restricted weapon in Canada (see page 3 here
http://www.cbsa-asfc.gc.ca/publications/pub/bsf5044-eng.pdf).
I suspect you might have been treated better if you had disclosed these things when you first entered but it doesn't sound like you did. Among the questions border guards always ask is 'Do you have anything to declare?' (pretty much open-ended, all encompassing), 'Do you have any firearms or weapons?' (you did) and 'Do you have any alcohol, tobacco or controlled substances?' (you did) Even if they didn't ask you, it's still your responsibility to be aware of the law (e.g. Border guards don't usually ask if you are carrying any heroin or any radiactive material but that doesn't mean you're allowed to if they don't ask ...)
As far as your friend past from 42 years ago, unfortunately, there's nothing you can do about that and it's going to come up every time. My wife was refused access to the US about 15 years ago because she was travelling with me and I had a US work permit. Since we were not legally married in the eyes of the US (we were common-law which is considered married in Canada but not in the US), she did not qualify as my dependant so could only enter as a tourist which is for up to 6 months. We had called ahead and had been told that it shouldn't be a problem but it's always at the discretion of the border guard. We were only going to the US for 6 weeks and told them that right from the start but because technically I could stay in the US indefinitely, she was denied entry because the border guard did not think she'd return to Canada if I decided to stay in the US longer ... Since she was refused entry to the US that time, now, whenever she tries to enter the US, she has to disclose that she was refused entry 15 years ago and is subject to further investigation. We were curious so we asked exactly what that meant a few years: If she doesn't disclose it and the guard notices it (it shows up on her profile at the border), she would probably be refused entry and likely banned from the US. The Border Guard are also entitled to seize the vehicle she is travelling in and anything in the vehicle since she tried to enter illegally.
As far as the indiscretion being 40 years ago and your friend having paid for it. That's not in the eyes of Border Guards. I have a friend who was charged with assault as a minor about 25 years ago in Canada. He spent 1 weekend in prison and several years ago was granted a pardon for the offence. A few years he was denied entry into the US at the airport (flying to Miami to go on a cruise) and was told that although he was pardonned in Canada, that doesn't mean he was pardonned in the US and as such he was still convicted of a felony and for that reason being denied entry. He had entered the US tons of times before that and has entered tons of times since but our border laws (both sides) are such that, for right or wrong, border guards can make unilateral decisions and there's nothing you can do about it.