When the ear gets swollen like this, it is from an aural hematoma. This is when the blood vessels within the ear flap burst due to excessive shaking of the head, scratching of the ears, or rubbing them on carpet/furniture/etc. Once the vessels burst, the blood and fluid pools into this pocket you are seeing. It can occur on the inside, outside, or both.
The reason behind its cause is almost always an ear infection. While dog's rarely get ear mites, they often do get bacterial or yeast infections, sometimes further down into the "L" shaped canal making it harder for us to see it and realize this is a problem.
I would definitely clean the ears by using an ear cleaner specifically made for dogs, available from any pet supply store or online catalog or vet. Make sure the canal is filled, then massage the base of the ear well, then allow your dog to shake the excess debris out. Wipe the exterior gunk off. Wash the ears daily, but gently.
You are eventually going to need an antibiotic or anti-fungal from the vet, depending on what the culprit is causing this. The vet will put a sample under the microscope to determine this. The day of your vet exam, don't clean the ears that morning, so some debris will be built up for a good sample.
Until then, continue cleaning daily and do your best to discourage scratching and further irritating the ears. I've included a link here (scroll down) to see how to properly clean the ears in case needed:
For the hematoma, on occasion they can heal up themselves if the shaking/scratching stops and the infection clears up quick. However, most often it needs to be lanced and drained by your vet, with a drain placed in order to keep the bacteria coming out, not being trapped under the skin.
These hematomas without treatment can sometimes burst, making a big mess, and requiring disinfecting (I like to use betadine 1 part solution to 10 parts warm water to clean 2-3 times daily). The can also sometimes cause some permanent damage to the ear itself. It is always in the best interest of the dog to have it fixed by a vet.
If there are any financial concerns, I would speak to your vet's office about care credit, which is a low to no interest credit card often used in emergency situations, and can be applied for directly at your vet's office.
Best wishes, and let me know if I can help further.