No, they don't count against the cap.
When a player retires due to injury, the contract continues to count against the salary cap for 2 years after the league determines the injury has occured. Since MacCulloch hasn't played a game since February 2003, his contract will no longer count against the sixers salary cap as of tomorrow.
Likewise, Jamal Mashburn hasn't played in a game since March 2004. Assuming he retires, he will no longer count against the salary cap as of next march.
For a past example, Matt Geiger (anyone remember him?) would actually still count against the Sixers salary cap. He's still receiving salary. But he retired, and he no longer counts against the Sixers salary cap.
In essence, mashburn's contract next year would be a better trading chip than an expiring contract. He would stop counting against a teams cap almost instantly after the deadline. What does this mean? Not only will they be trading out long term contracts that they would have had to pay for years to come, but they are acquiring a contract that is 80% paid by insurance. So that means on top of the additional years of a contract they are saving, they save 8 million this year, PLUS a dollar for dollar tax they would have paid in luxury (since Mashburn won't count for cap purposes).
So, typically a team with a 10 million dollar contract with 3 years remaining after this and 10% raises would spend:
Year 1: 10 million
Year 2: 10.1 million
Year 3: 10.2 million
Year 4: 10.3 million
Total Salary: 40.6 million
Luxury Tax on Year 10: 10 million
Total Spent: 50.6 million
When they trade for an expiring:
Year 1: 10 million
Year 1 Luxury Tax: 10 million
Total Spent: 20 million (save 30.6 million)
In Jamal's case, it would look like this:
Year 1: 2 million (20% of Jamal's salary)
Luxury Tax: 0 million (comes off salary cap in March)
Total Spent: 2 million (48.6 million saved).
Bigtime savings.