MONTPELIER — When it comes to real estate, the state of Vermont has always tended to buy high and sell low.

But the sale earlier this year of a building known as “IBM 617” closed the final chapter in one of the costliest misfires in the history of government land purchases in Vermont. And top policymakers, including some of the elected officials responsible for authorizing the purchase, say the nearly $4 million loss suffered by the state offers some instructive lessons on how not to conduct business in the future.

“Unforeseen circumstances, differing visions, and the marketplace all played a role in how it turned out, and it obviously is something that we all regret in some ways,” said Lt. Gov. Phil Scott, who served as chairman of the Senate Committee on Institutions when Vermont purchased the building in 2005. “I think about it often — what should we have done differently? Because we certainly can’t afford to let something like that happen again.”

When Vermont purchased the 180,000-square-foot building from Pizzagalli for $6.2 million in 2005, it was to be the new home of several key government institutions, including health and forensic laboratories, state police barracks and an emergency operations center.

Instead, the structure, which stands on a 50-acre parcel on Allen Martin Drive in Essex, served almost no useful purpose during the eight years Vermont would own it. The state finally sold the building in April for $2.4 million to a developer based in Williston.

The nearly $4 million bath the state took on the deal doesn’t include the approximately $250,000 it spent annually on heat, electricity and basic grounds maintenance to “mothball” the empty facility while it sat empty. All told, the state sank about $6 million into an investment that yielded virtually no return.

“At some point you’ve got to decide to cut your losses,” said Rep. Alice Emmons, chairwoman of the House Committee on Corrections and Institutions, a role she held back in 2005.

The state’s purchase of the building occurred under the administration of Gov. James Douglas, when the real estate market was at its height. The space, which had been used as a chip manufacturing plant by IBM during the previous 20 years, looked like an ideal fit for the high-tech labs lawmakers knew would need to be replaced within the next few years.

“Instead of building two separate entities at two separate locations in two separate buildings, we could purchase 617,” Emmons said. “The opportunity was there, so we went ahead and took it, with the full intention of putting the health lab and forensics lab in there.”

Emmons said cash-flow issues soon began to put a crimp in the master plan. Constructing both labs would require nearly $40 million in up-front capital costs, money that would take at least a few years to stockpile through appropriations in the annual capital bill. The forensics lab, meanwhile, was coming up against a re-certification deadline from the federal government, and the current lab, according to Emmons, wasn’t going to come close to passing muster.

“We needed a forensics lab, but we didn’t have enough money to move forward with plans for both labs at 617,” Emmons said.

So lawmakers approved a plan to redo the old forensics lab at its current location in Waterbury.

Plans for locating the health lab at 617 would prove similarly fruitless, as the state would ultimately opt to partner with the University of Vermont at a location in Colchester.

Scott said there should have been more communication between administration officials and lawmakers and the state agencies on whose behalf they had decided 617 would be a good fit.

“It turned out that folks from public safety, they didn’t see (Essex) that as a location they desired,” Scott said. “And we met with some resistance from the health department too, which didn’t want to relocate from Cherry Street in Burlington. And the city of Burlington didn’t want to lose those employees they had in the downtown. It seemed like everyone was mounting a challenge to what we thought was the best approach.”

Administration Secretary Jeb Spaulding said that the building wasn’t even suitable as temporary office space for the 1,500 state workers displaced from Waterbury after Tropical Storm Irene.

“We actually went and looked at it at the time to see if it would be, but it needed a lot more renovation to make it usable than seemed justified,” Spaulding said.

The 617 building has been for sale for years, though it was never listed with a commercial broker. Emmons said the building had plenty of potential suitors, including a renewable energy company that came especially close to cutting a deal, but that none followed through with a purchase.

The state was on the verge of listing with a commercial broker in late winter, when an unsolicited offer arrived from Bobby Miller at the REM Development Company. The $2.4 million was less than what the state had been hoping to get — the property was last valued by town listers for about $4 million. But Spaulding said he spoke with numerous commercial real estate experts, all of whom told him he should take Miller’s cash offer.

“The building was getting in worse shape as it was sitting there, so at some point you have to make a decision not to throw good money after bad,” Spaulding said.

Commissioner of Buildings and General Services Michael Obuchowski said Essex town officials are thrilled to have the property back on the tax rolls, and Spaulding said jobs related to the multi-building industrial park Miller intends to construct on the property will offset some of the state’s losses in the form of new tax revenue.

Spaulding, Emmons, Scott and others say the experience offers some important, if costly, lessons. Emmons said the two-year budget cycle adopted by the Legislature in 2010 comes in part as a result of experiences like the one with 617, where shorter-term planning prevented the kind of foresight that might have otherwise averted a bad deal.

Obuchowski said Vermont’s planning policy has also evolved since 2005, and that the administration now uses a 10-year time horizon to analyze the merits of various planning decisions, as opposed to the six-year vision it had relied on previously.

Spaulding said one of his takeaways is “if you’re in hole, stop digging.”

“If you have a lemon that’s about to go bad, try to make lemonade,” Spaulding said. “And I think that’s what we’ve done here.”

Perhaps one final lesson, as Scott said half-jokingly: “Stay out of the real estate business.”