Mahon started his career at Prenton Park and the midfielder now returns for a second spell with the club after being released by the Clarets at the end of last season.
The 31-year-old said: "I'm thrilled to come back to the club that started my career. The new management team has impressed me and I can't wait to get started."
New Tranmere boss John Barnes said: "It's great to have Alan back as he is a very talented midfielder.
"We're fortunate to have got a player of Alan's quality to commit himself to the Club for three seasons. He is a former favourite of the Tranmere fans and I'm sure they'll look forward to seeing him in action again at Prenton Park. He will add experience to what will be a young squad next season."
Mahon made 144 appearances for Tranmere in his last spell with the club and was a key member of the side that reached the League Cup Final at Wembley Stadium in 2000.