Carroll completed his transfer to the Hammers for an undisclosed, club-record fee on Wednesday after spending the majority of last term at Upton Park, scoring seven goals in 24 appearances.
And Allardyce thinks Carroll's previous experience with the Hammers was vital in bringing him to east London for good.
"Our relationship over the 12 months he was here was key to this deal," Allardyce told the club's official website.
"He came to us in a difficult frame of mind and had suffered with injuries but the support the coaching staff and the rest of the boys that work so hard behind the scenes was something he felt very comfortable with in the end.
"He met new team-mates over the year and enjoyed their company and I think that definitely helped him to make the decision to return to West Ham.
"So not only did the loan pay off by us finishing 10th in our first season back in the Premier League but it has paid off by him choosing us."
Allardyce has put pen to paper on a six-year deal with West Ham, after slipping down the pecking order under Brendan Rodgers at Anfield following his £35m move from Newcastle.
"The size of the contract is a statement of West Ham's belief in Andy and Andy's belief in West Ham," added Allardyce.