The 49ers are the new Raiders.

The old Raiders had to overpay free agents to compensate for three things:

1. The team’s bad record.

2. The cost of living in the Bay Area.

3. Income and property taxes in California.

In 2004, Al Davis gave washed-up, 32-year-old Warren Sapp a seven-year, $36.6 million contract to join the Raiders instead of the Bengals, who were offering Sapp only four years and $16 million.

In 2008, Davis traded for overrated cornerback DeAngelo Hall, then signed him to a seven-year, $70 million contract and cut him after eight games. That same year, Davis gave washed-up wide receiver Javon Walker, who had undergone three surgeries on his right knee, a six-year, $55 million contract. Walker caught 15 passes for the Raiders and retired after two seasons.

Given the Raiders’ situation, Davis had to overpay, but he overpaid the wrong players.

The Niners are what the Raiders used to be. They have to overpay for talent. They have more than $56 million in cap space, they’re coming off a 5-11 season and are the worst team in the NFC West. They’ll have to overpay to sign anyone good. The key is identifying the right player to overpay.

Before I reveal who that player is, here are the wrong players to overpay, the players the 49ers absolutely should not sign unless they get a bargain rate.

1. Muhammad Wilkerson, DE, New York Jets. A former first-round pick and two-time All Pro, Wilkerson is the best defensive lineman on the market. He plays “5-technique,” which is a fancy way of saying he plays left defensive end in a 3-4 defense. That’s the same position 49ers first-round pick Arik Armstead plays.

Signing Wilkerson would block Armstead’s growth in Santa Clara. Why would the Niners do that? Why give up on Armstead after only one year when he seems like a special talent and is younger and much cheaper than Wilkerson? Forget Wilkerson. Develop Armstead.

2. Malik Jackson, DT, Denver Broncos. This Super Bowl champion is the second-best defensive lineman on the market after Wilkerson. Jackson plays “3-technique,” which means he would play right defensive end in the Niners’ 3-4 defense. That’s Justin Smith’s old position, and Quinton Dial’s current one.

Dial is one of the best players on the 49ers, and he’s getting better. Last season was his first as a full-time starter, and he was terrific. The Niners don’t need to replace him. They should spend their money on a different position.

3. Danny Trevathan, ILB, Denver Broncos. One of the 49ers’ biggest holes is inside linebacker, and Trevathan is the best one on the market. He’s 25 and entering his prime.

The Niners should stay away from him.

In 2013, Trevathan broke his kneecap and missed 13 games. He is damaged goods. Instead of overpaying him and his surgically repaired knee, the Niners should simply draft an inside linebacker who doesn’t have a surgically repaired knee and can start right away.

4. Marvin Jones, WR, Cincinnati Bengals. Anquan Boldin is a free agent and the Niners need a young receiver to replace him. Jones, a former Cal Bear, is only 25, and he caught 65 passes for 816 yards last season with the Bengals.

Before the Niners even consider signing a wide receiver, they need to figure out what to do with the receivers they have already. Quinton Patton and Bruce Ellington may be fantastic — no one knows. The Niners almost never throw them the ball. Give those two a shot before burying them on the depth chart behind an overpaid free agent like Jones. Stay away from Jones.

5. Bruce Irvin, OLB, Seattle Seahawks. This is the No. 1 free agent the Niners must avoid. Signing Irvin would be a colossal mistake.

Irvin is a good player — don’t get me wrong. He just doesn’t fit the 49ers’ base defense. He played strong-side linebacker in the Seahawks’ 4-3 defense, and would play outside linebacker in the 49ers’ 3-4 defense — a totally different position.

Irvin isn’t strong enough to play outside linebacker in the Niners’ 3-4. He’d be terrible against the run from that position. He has narrow hips and a light lower body — offenses would run right at him. The Niners would have to bench him and play him only in the Nickel and Dime defenses. What a disaster that would be.

Instead of signing Irvin or Jones or Trevathan or Jackson or Wilkerson, the Niners should spend their money on a cornerback, specifically one who plays on the right side of the defense. The Niners have a huge hole at that position.

They should overpay former Kansas City Chief Sean Smith, one of the best corners on the market. He’s tall like Richard Sherman, and specializes in playing the right side of the field. He’s a perfect fit for the Niners’ defense. They should give him whatever he wants. They have the cash.

Grant Cohn writes sports columns and the “Inside the 49ers” blog for The Press Democrat’s website. You can reach him at grantcohn@gmail.com.