You can decline assignments without blowing the job opportunity!
If this is an opportunity you really want to pursue, you still have options.
Try asking to alter the assignment. “This project, if done properly, would take 12-20 hours and I would like to show you my capabilities within a 1-2 hour timeframe so you can sample my talent, which I assume is the purpose of this exercise. Would [example of a condensed version of the project] work for you?”
If you’re feeling direct, you can say: “I don’t typically do spec work prior to employment, but I’d love to send along work I’ve done that is similar and offer analysis into how it is within your framework?”
For those who already have deep expertise in your area, let’s say you’re a senior developer, try: “I don’t expect you to change your hiring practices for every candidate, but I am one of only a handful of people with the expertise you’re seeking – I have an extensive GitHub repository, I’ve been published in 23 news sources on the topic, and written three books, all of which demonstrate my work product.” Risky, but it could work if you really are the unicorn they’re seeking.
If you’re straight-up gutsy, try: “That sounds like a project that is within my capabilities and based on what I’ve learned so far, I believe it would take [number of] hours. My rate is [$] per hour – what is your preferred billing method?”
Similarly, if the request is akin to building a deployable app: “I’d love to do that project for you as an independent contractor – let’s talk!”
Those last two methods probably won’t get you anywhere, but you never know. It could press them to alter the project requirement if they already think you’re THE candidate.