To clarify, the free lockers are only offered at rides that require you to place bags and loose articles in them because bags/loose articles pose safety concerns or may interfere with safety restraints on the respective ride. Because no loose articles are permitted on these rides, they provide the lockers for free for the brief time you are on the ride. The lockers tell you how long it will remain free (usually more than enough time to get through the queue, on the ride, and back to the locker). After the free period expires, they do impose a fee if you intend to keep using it.
The lockers at Dudley Do Right impose a fee from the beginning because the ride allows people to bring bags on the ride. In other words, they do not require bags and loose articles be secured for safety reasons. Therefore, they do not provide a free solution for this.
There are also lockers at the front of the park that you can rent for a flat fee for the duration of the day. These never have a free period either.