Motion for summary judgment usually happens toward the end of the case near trial. It asks the judge to rule for one side without a trial because no reasonable jury could find for the other side.
While a plaintiff can win summary judgment, it is more common for a defendant to file and win.
Regarding the cost, the average attorney in the USA makes maybe $90,000. Overhead can be very high, and many clients seem to expect their attorney to be flashy with an oak paneled office full of law books. A big yellow pages ad can cost $50,000, and then there are billboards, urinal ads for DWI lawyers, etc. Lawyers also have issues with people not paying their bills.
Personally I opted out of this because I started my firm when I was still in my 20’s and without the funds to go so fancy. My marketing budget is most years under $1000, some years 0, and I have cheap office space full of Ikea furniture. I did not need a marketing budget because I was the only lawyer in California who would take a certain type of real estate case on contingency during the real estate crisis eight years ago, so I just publicized my first few cases and Google searches did the rest.