She bought that book for next to nothing.

Literal

She [topic-は] that book [object-を] free-equivalent [for-で] bought.

ただ同然 is a fixed expression: ただ ('free, gratis') + 同然 ('equivalent, just the same as') — literally 'practically free,' meaning 'almost as good as free.' で here marks the price or means of the purchase: 'bought it at next-to-nothing.' The phrase has the flavor of a bargain hunter — the kind of thing you'd say after a great find at a flea market or used-book shop. 同然 also turns up in expressions like 死んだも同然 ('as good as dead') and 子供同然 ('practically a child').