The Rams do not yet have a head coach. McDaniels was under contract to them and, as such, was an asset. Teams generally do not part with assets unnecessarily, but in this case, the Rams did have some incentive.
First, they clearly did not think McDaniels would fit with their next head coach. They were in position to know this simply by checking with Jeff Fisher and any other candidates for the head-coaching position. They also knew that McDaniels was under contract to them for only the 2012 season, meaning he could have left the team one year into the next coach's tenure, setting back the offense.
Once that determination was made, the Rams had a financial incentive to let McDaniels leave for New England. As joanmmj pointed out in the comments section of an earlier item, firing McDaniels would have forced the Rams to pick up some of his salary. Letting McDaniels go to the Patriots means New England will assume all the financial burden for the one year remaining on McDaniels' contract with St. Louis.
Had McDaniels been fired, rules would have required his next NFL team to pay him a competitive wage, with the Rams picking up the difference. With the Patriots picking up the full tab, the Rams can commit the savings to their next staff. League rules would have prevented the Rams from extracting cash or draft choices from the Patriots for McDaniels; such exchanges are allowed only for head coaches and top executives.
McDaniels' previous employer, the Denver Broncos, would seem to be the biggest short-term losers in the current arrangement. They are facing the Patriots in the divisional playoff round. McDaniels is now free to provide the Patriots with detailed scouting reports on the players he coached in Denver.