Lumber is expensive, there's really no way around that. And you need high-quality, rot-resistant lumber for raised beds not just because it lasts longer but also because cheaper wood that rots within 1-2 years will also harbor more insects, diseases, fungus, and moisture.
That said, I would check Habitat for Humanity stores, ask around at construction sites, and so forth. You may even be able to find free bricks/masonry. You can also sometimes find relatively good-quality topsoil being sold by the truck instead of by the bag. In the long-run that's cheaper but the quality can vary a lot.