The chap in the frivolous hat, looking as if he's considering nothing more taxing than replanting the herbaceous border and possibly lunch, is the great economist John Maynard Keynes - painted in 1917 by his lover, Duncan Grant.

The beautiful and tender portrait shows Keynes working (on how to finance Britain's role in the first world war, according to his daughter) in the garden of Charleston farmhouse, country bolthole of the Bloomsbury group, of which he was undoubtedly the most wildly improbable member.

The painting will be displayed for the first time at the Sussex farmhouse, where it hung for years after his death. It has been withdrawn from auction and bought by the Charleston Trust, which now runs the house as a museum, after just six weeks of frantic fundraising.

The trust raised £100,000 to keep it from auction, with major grants from the National Heritage Memorial Fund and the Art Fund charity.

Keynes died in 1946, aged 63, said to have been worn out by overwork. Grant, arguably the nicest of the Bloomsburies and certainly the best artist, outlived almost all his friends, working on at Charleston until 1978. After his death the house was opened as a museum. The trust maintains it as a shrine to the jaw-dropping interior decor tastes of the Bloomsburies, and has restored the garden.

Grant kept the painting until 1956, when a London dealer contacted him for a client who wanted a portrait of the much photographed, rarely painted economist. Alastair Upton, director of the trust, said: "Portrait of John Maynard Keynes is quite simply a wonderful painting by an artist at the height of his powers, that also tells an extremely powerful story."

Keynes, regarded as one of the greatest and most original economists of all time, is still revered by many contemporary money men: he argued for interventionism, warning against hoping things would sort themselves out in the long run - "in the long run we are all dead" - and directly influenced the creation of the International Monetary Fund and the World Bank.

He was also the oddest member of the tangle of writers and artists known as the Bloomsbury Group. Grant kept the painting in his studio long after his lover stunned the Bloomsburies by outing himself as bisexual, if not straight. Keynes turned up at Charleston in 1925 with his new wife, the Russian ballerina Lydia Lopokova, a member of Diaghilev's famous Ballets Russes company. The Bloomsburies relished being shocking, but were quite shockable themselves, and thought her habit of dancing naked in the dawn fields beyond the pale. Millions of art lovers have walked over her: she appears as the muse Terpsichore in the mosaics by her friend Boris Anrep halfway up the main stairs of the National Gallery in London.

Keynes was friends with most of the gang, including Virginia Woolf and her sister Vanessa Bell, their long-suffering spouses, Leonard Woolf and Clive Bell, the painter and critic Roger Fry and the essayist Lytton Strachey, as well as the society hostess Lady Ottoline Morrell - lover of Bertrand Russell - and the painter Walter Sickert. Sickert was recently accused by the American crime writer Patricia Cornwell of being the true Jack the Ripper.

Despite spending most of his life with Treasury mandarins, Keynes was intensely interested in the arts. After attending the Versailles peace talks after the first world war, he made his name with a small book mainly written at Charleston, Economic Consequences of the Peace, correctly predicting the dire implications of the punitive settlement. His 1936 tome The General Theory of Employment, Interest and Money was an academic and political sensation, and became a bestseller.

Backstory

The Bloomsbury group first met at 46 Gordon Square, Bloomsbury, London home of Virginia Woolf, Vanessa Bell, Thoby Stephen and Adrian Stephen. There Thoby introduced his lover, the artist Duncan Grant. Vanessa, whose lovers included Roger Fry, had Grant's baby - a birth attended by Grant and her husband Clive Bell. Virginia married Leonard Woolf, and had lovers including Vita Sackville-West.